read_allocate(3)

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

okay so this is from the Staden Package manual, section 3, and it's literally about the read_allocate(3) and read_deallocate(3) girlies. they're a package deal, fr fr. let's get into it 🫢


✨ NAME ✨

read_allocate, read_deallocate β€” allocate and deallocate the Read structure. yes that's the whole job, and they ate πŸ’…


🌸 SYNOPSIS 🌸

#include <Read.h>

Read *read_allocate(
     int num_points,
     int num_bases);

void read_deallocate(
     Read *read);

πŸ¦‹ DESCRIPTION πŸ¦‹

so these two functions are the ones that create and destroy Read structures. and what even is a Read structure? it's a generalised in-memory data structure used for holding trace data information. iconic behaviour, no cap ✨

read_allocate() makes you a Read structure that's big enough to hold num_points trace sample points and num_bases called bases. then all that allocated data gets initialised to appropriate defaults β€” which are mainly zeros and null pointers. clean slate energy 🧼

read_deallocate() destroys a Read structure you made earlier. and bestie, listen β€” it is not sufficient to simply use the free() call instead. do not do that. use the actual deallocator. it's giving "there's a right way and a wrong way" πŸ™ˆ


πŸ‘‘ RETURN VALUES πŸ‘‘

  • when read_allocate() finishes successfully, it returns a pointer to a Read structure. otherwise? this function returns a null pointer. so like, check it πŸ’€
  • read_deallocate() returns no value. it's void, she gives nothing back, she just does her job πŸ’…

🌈 SEE ALSO 🌈

go read those too, the whole squad is worth your time πŸŽ€


mwah, that's the page! this one came from the Staden Package and it's the read_allocate(3) manual page, so if you ever need to cite your sources, that's the vibe. love u, bye πŸ¦‹πŸ’–β­