EC_STRVEC_FROM_ARRAY(3)

πŸ’– EC_STRVEC_FROM_ARRAY πŸ’–

okay bestie, so this is a page from the Libecoli Programmer's Manual, section 3 β€” and we're talking about ec_strvec_from_array, which is genuinely the most "build me a whole new string vector out of thin air" function you will ever meet. No cap. ✨


🌸 NAME 🌸

ec_strvec_from_array β€” literally just: allocate a new string vector. That's the whole job. She's an icon, she does one thing, she slays at it. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <ecoli/strvec.h>

struct ec_strvec * ec_strvec_from_array(
    const char *const   *strarr,  /* The array of const strings. */
    size_t               n        /* The number of strings in the array. */
);

So she takes two things, right:

  • strarr β€” the array of const strings. Yes, const char *const *, the double-const situation, she's committed, she's not touching your strings, periodt. πŸ’…
  • n β€” how many strings are in that array. You gotta tell her, she's not psychic, bestie. πŸ¦‹

πŸ¦‹ DESCRIPTION πŸ¦‹

The string vector gets initialized with the array of const strings that you passed in as arguments. That's it. You hand her an array, she hands you a fresh little strvec holding those exact strings. it's giving "glow up, but make it data structure." ✨🌈


πŸ’œ RETURN VALUE πŸ’œ

You get the new strvec object back β€” yay!! πŸŽ‰πŸ«Ά

BUT. If something goes wrong, you get NULL instead, and errno is set. So like, always check, bestie. Not me ignoring a NULL return and then crying at 3am. πŸ˜­πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

the whole girl gang, all up in here β€” go read these too fr fr:


Copyright (C) 2010-2026 Olivier Matz, Robin Jarry. Respect the authors, they ate. πŸ’–


ok so that's the whole page, no skips, no summaries, every single detail preserved because that's just how we do it around here. πŸ’…βœ¨

and finally, the cute lil sign-off: this whole thing lives in libecoli, dated 2026-06-11, and yes it's page EC_STRVEC_FROM_ARRAY(3) of the Libecoli Programmer's Manual. mwah. πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from