cdb_free(3)
πΈ cdb_free β from the Library Functions Manual πΈ
okay bestie, pull up a chair because today we're talking about cdb_free, a little function from the Library Functions Manual that is honestly the cleanest breakup artist in the whole cdb friend group π
β¨ NAME β¨
cdb_free β close a constant database π
β¨ SYNTAX β¨
#include <libowfat/cdb.h>
int cdb_free(struct cdb *c);
that's it. one include, one call, one int coming back at you. iconic behavior, no notes π«Ά
β¨ DESCRIPTION β¨
so like. cdb_free removes any memory mapping that cdb_init might have established. that's the whole job. it's the "okay we're done here, everybody out of the pool" function π
but β and this is the part where the plot twists β it is not your all-purpose cleanup goblin. it will not close the file descriptor that you passed to cdb_init. that fd is yours, bestie, you opened it, you close it, that's a you problem and I say that with love π
and it will not attempt to call free() on the struct cdb pointer either. nope. not touching it. if you allocated that struct yourself, that's still on you to handle. cdb_free is out here doing exactly one thing and refusing to do your chores for you. respect the boundaries fr fr π
lowkey important: this thing does not do full teardown. it unmaps, that's it. fd and struct cdb cleanup are your responsibility, no cap.
β¨ SEE ALSO β¨
cdb_free(3)β yes, it's linking to itself. main character energy, honestly πcdb_read(3)cdb_find(3)cdbmake(1)
and that's the page!! it came out of the Library Functions Manual, the footer just says cdb_free(3) all over again because it loves a dramatic callback, and there's no date or version info to report, so we're just gonna vibe π¦
stay mapped, stay hydrated, and remember to close your own file descriptors, babe πβ¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms