MSR_INIT(3)

πŸ’– MSR_INIT(3) β€” it's giving "Library Functions Manual" ✨

okay bestie, welcome to the libmseed section 3 glow-up πŸŽ€ this one's all about spinning up and tearing down your MSRecord structs and the lil blockette chain that lives inside them. no cap, it's a short one, but it's important, so let's go πŸ’…


🌸 NAME 🌸

msr_init β€” initializing and freeing MSRecord and related structures πŸ¦‹


✨ SYNOPSIS ✨

#include <libmseed.h>

MSRecord *msr_init ( MSRecord *msr );

void      msr_free ( MSRecord **ppmsr );

void      msr_free_blktchain ( MSRecord *msr );

like, three functions, three vibes, one header. slay πŸ”₯


πŸ‘‘ DESCRIPTION πŸ‘‘

🫢 msr_init

msr_init will initialize a MSRecord structure, periodt.

  • if the msr parameter is NULL, a new structure will be allocated for you. it's giving "treat yourself" πŸ’–
  • if the msr parameter is not NULL, the blockette chain (MSRecord.blkts) will be freed 🧹 β€” but heads up, any memory allocated for MSRecord.fsdh and MSRecord.datasamples will be preserved, because it's going to get cleanly re-used by routines such as msr_unpack(3). the way that it recycles memory... iconic ♻️

🌈 msr_free

msr_free will free all memory associated with a MSRecord structure β€” including the blockette chain β€” and it sets the structure pointer (*ppmsr) to 0. so like, zero it out, no dangling nonsense, we do NOT do dangling pointers in this house πŸ™ˆ

🧚 msr_free_blktchain

msr_free_blktchain will free all memory associated with the blockette chain of an MSRecord structure. and bestie, the shortcut blockette pointers will also be reset πŸ”

ngl, if you're only nuking the chain and keeping the rest of the record alive, this is your girl. if you want the whole thing gone, that's msr_free's job πŸ’…

⭐ RETURN VALUES ⭐

msr_init returns a pointer to the MSRecord structure initialized on success πŸ’– or NULL on error 😭


πŸ”₯ SEE ALSO πŸ”₯

ms_intro(3), msr_pack(3) and msr_unpack(3) β€” go read those too, iykyk πŸ“š


πŸŽ€ AUTHOR πŸŽ€

Chad Trabant IRIS Data Management Center


okay that's the whole page, bestie!! this one came straight out of the Libmseed API, dated 2006/02/27, and yes it is still out here living its MSR_INIT(3) main character era πŸ‘‘ go forth and free your memory responsibly, ily 🫢🌸