EC_NODE_E...RENTHESIS(3)

πŸ“¦
version 0.11.7 Β· 4 versions
, in fedora 44

✨ NAME ✨

ec_node_expr_add_parenthesis β€” bestie, this is the one that gives your expression node some parentheses, okay? Like, actual ( and ) energy. We're wrapping things. We're containing things. It's giving structure. πŸ’…

(Also hi, you're in the Libecoli Programmer's Manual, section 3, so you already know this is a library function and not, like, a command you type. Just so we're clear. πŸŽ€)


🌸 SYNOPSIS 🌸

#include <ecoli/node_expr.h>

int ec_node_expr_add_parenthesis(
    struct ec_node   *gen_node,  /* The expression node. */
    /*
     * The opening parenthesis node. It is consumed and will be freed when the
     * parent is freed, or immediately on error.
     */
    struct ec_node   *open,
    /*
     * The closing parenthesis node. It is consumed and will be freed when the
     * parent is freed, or immediately on error.
     */
    struct ec_node   *close
);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, here's the vibe check on the arguments, because there are three of them and each one matters:

  • gen_node β€” the expression node. The main character. Your actual expression that's about to get wrapped up all cozy. πŸ’–
  • open β€” the opening parenthesis node. 🫢
  • close β€” the closing parenthesis node.

Now, the important part, and I need you to listen, bestie: open and close are consumed. Not borrowed. Not "we'll hold onto a reference and you keep it around." Consumed. 😭

That means:

  • If the parent gets freed, they get freed too. They go down together. Ride or die. πŸ’€
  • If there's an error, they get freed immediately β€” like, right then, on the spot, no waiting around.

So do not go freeing open or close yourself afterwards, and do not keep using them. That's a double-free situation and it's not cute. πŸ™ˆ


πŸ”₯ RETURN VALUE πŸ”₯

  • 0 on success ✨ (slay, it worked)
  • -1 on error, and errno is set πŸ’€ (so check errno, fr fr)

πŸ‘‘ SEE ALSO πŸ‘‘

the whole little friend group, go read these too:


Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.


and that's the whole page, bestie!! written for <b>libecoli</b>, dated <b>2026-06-11</b>, and honestly? iconic. go add some parentheses. you got this. πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from