hdf_set_valuef(3)

πŸ’– hdf_set_valuef β€” bestie edition πŸ’–

ok so we're in hdf_set_valuef(3), and the manual we're living in is util/neo_hdf.h. pull up a chair, grab a strawberry πŸ“, this one's short and sweet.


✨ NAME ✨

hdf_set_valuef β€” set the value of a named node. that's it, that's the whole job πŸ’…


🌸 SYNOPSIS 🌸

#include <util/neo_hdf.h>

NEOERR* hdf_set_valuef (HDF *hdf, const char *fmt, ...)
                        ATTRIBUTE_PRINTF(2,3);

πŸŽ€ ARGUMENTS πŸŽ€

  • hdf β€” the pointer to the hdf dataset. the whole vibe lives here.
  • fmt β€” the name=value printf(3) format string. yes bestie, it's a format string, and the compiler is watching you (see that ATTRIBUTE_PRINTF(2,3)? that's the compiler watching you).

πŸ¦‹ DESCRIPTION πŸ¦‹

ok so hdf_set_valuef is literally just a convenience function that wraps hdf_set_value. it's giving "I'm the friendly little sibling who does the annoying part for you" 🫢

here's the thing though β€” C has limitations, and because of them the fmt has to be in the format "name=value". so what happens is: we first format the entire string, and then we break it at the first (from the left) equal sign (=), using the left portion as the name and the right portion as the value. the way that one = decides everything… main character energy fr.

ngl, this function is somewhat inefficient: it first allocates the full name=value, then the call to hdf_set_value duplicates the value portion, and then we free the name=value. so that's three whole steps for one little set. we do it anyway. slay.

also β€” currently, we don't strip whitespace from the key or the value. so whatever spaces you put in there? they're staying. no cap.

and in the future, this function might work more like reading a single line of an HDF string or file, allowing for attributes and symlinks to be specified… maybe. πŸ‘€ (the manpage itself said "maybe", I'm not making that up, that's the actual energy of this documentation and I respect it deeply)


🌈 RETURN VALUE 🌈

None. that's it. nothing. no return value, no drama. πŸŽ€

heads up: the declared return type is NEOERR*, so you do get a return you should check β€” but this manpage's RETURN VALUE section says None, and we don't make stuff up around here. so: the documented return value is None. periodt.

πŸ‘‘ SEE ALSO πŸ‘‘

the whole extended family, every single one, no skipping:


ok that's the page!! πŸ’– this one came from ClearSilver, dated 12 July 2007 β€” yes bestie, 2007, she's vintage, she's iconic, she's still out here setting values. go forth and name=value responsibly 🧚✨