DC_DESCRIPTOR_GET_VENDOR(3)

πŸ“¦ version 0.9.0, in nixos 26.05, nixpkgs unstable

πŸ’… dc_descriptor_get_vendor(3) β€” the library functions manual, bestie edition

okay so this is a page from the libdivecomputer manual, section 3 (library functions), and it's about one smol function that gets you the vendor name off a dive computer descriptor. yes. that's the whole vibe. let's get into it 🫢


✨ NAME ✨

dc_descriptor_get_vendor β€” literally just gets the vendor of a dive computer descriptor. that's it. that's the function. πŸŽ€


πŸ“š LIBRARY πŸ“š

the library is libdivecomputer, bestie. that's where all this lives. πŸ’–


🧚 SYNOPSIS 🧚

like this:

#include <libdivecomputer/descriptor.h>

const char *
dc_descriptor_get_vendor(const dc_descriptor_t *descriptor);

so you pull in that header, and then you call the function with a pointer to a dc_descriptor_t. simple as. ✨


🌸 DESCRIPTION 🌸

the way this works is: you hand it a dive computer descriptor, and it gives you back the vendor β€” think stuff like "Suunto" β€” as a string. iconic.

and if nobody ever declared a vendor for that descriptor? you get NULL. no vendor, no problem. πŸ’€


πŸ¦‹ RETURN VALUES πŸ¦‹

so what comes back out:

  • a nil-terminated vendor string β€” that's your friendship bracelet of text πŸŽ€
  • or NULL if none exists at all
⚠️ real talk tho, bestie: the returned pointer is not valid after the descriptor has been freed. like, it's not yours anymore. reading it after a free is giving undefined-behavior main character energy, and not in a good way. do not do it. πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€


πŸ‘‘ AUTHORS πŸ‘‘

the library libdivecomputer was written by Jef Driesen β€” jef@libdivecomputer.org. πŸ“§

the manpages were written by Kristaps Dzonsons β€” kristaps@bsd.lv. πŸ“§

absolute legends, both of them. no cap. πŸ”₯


okay that's the whole page, you're officially educated πŸ’… and this cutie dropped on Debian, January 5, 2017 β€” that's the source and the date, sign-off complete, mwah πŸ“βœ¨

πŸ“¦ where this page comes from