gd_invalid_dirfile(3)
π gd_invalid_dirfile β the GETDATA manual, bestie edition π
okay so real quick, this page lives in the GETDATA manual, and it's all about gd_invalid_dirfile(3). yes that's the whole vibe. let's go β¨
β¨ NAME β¨
gd_invalid_dirfile β obtain an pointer to an invalid DIRFILE object π«Ά
(yes the original says "an pointer". we do not fix the original. we respect the original. periodt.)
πΈ SYNOPSIS πΈ
#include <getdata.h>
DIRFILE* gd_invalid_dirfile(void);
like, that's it. no arguments. she takes nothing and she gives you a DIRFILE*. iconic π
π¦ DESCRIPTION π¦
so bestie, gd_invalid_dirfile() hands you back a pointer to a newly allocated, invalid DIRFILE object. like, she's real, she exists in memory, she's justβ¦ not valid. it's giving "made it five minutes ago and already has no purpose" π
but here's the thing β even though she's invalid, she's still a DIRFILE object like any other, which means you still gotta de-allocate her when you're done. you do that by calling gd_close(3) or gd_discard(3). no leaving her hanging, that's rude fr fr.
now. the DIRFILE object you get back? you can pass it to any other GetData function that wants one. nobody's stopping you. but doing so will inevitably make that function fail with the GD_BAD_DIRFILE error. like, every single time. it's not a "maybe". it's not a "sometimes". it's inevitable. the way that this object has one job and that job is being rejected π
π you could also justβ¦ do this instead π
ngl there's a similar effect you can get by making a bad gd_open(3) call, for example:
gd_open("", 0);
that also returns a pointer to an invalid DIRFILE object! so like, same energy. BUT. and this is the important part β the difference is:
- an invalid
DIRFILEcreated that way has a non-zero error code, which you can get withgd_error(3). - meanwhile, the dirfile error of the invalid
DIRFILEreturned bygd_invalid_dirfile(3)is zero, which indicates success.
so like. same object energy, completely different error situation. iykyk π€«
π₯ RETURN VALUE π₯
this function always returns a pointer to a newly allocated, invalid DIRFILE object.
β¦except when it can't allocate memory for the DIRFILE. in that case it returns NULL. that's the one and only exception, bestie. if you get NULL, it's not a vibe, it's a memory problem π
π HISTORY π
the gd_invalid_dirfile() function first appeared in GetData-0.7.0. a legend was born. β¨
β SEE ALSO β
go read those too, they're all part of the same little friend group π«Ά
Version 0.10.0 πΈ 25 December 2016 β that's the version and date this page is serving, and honestly? a christmas-day release is main character energy. slay, gd_invalid_dirfile(3). we love a lowkey useless-but-well-documented function. πππ¦
π¦ where this page comes from
- debian bookworm: libgetdata-doc 0.11.0-6
- debian trixie: libgetdata-doc 0.11.0-15
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- nixos 26.05: getdata 0.11.0
- nixpkgs unstable: getdata 0.11.0
- ubuntu jammy: libgetdata-doc 0.11.0-3ubuntu1
- ubuntu noble: libgetdata-doc 0.11.0-13
- ubuntu questing: libgetdata-doc 0.11.0-15
- ubuntu resolute: libgetdata-doc 0.11.0-17build1
- ubuntu stonking: libgetdata-doc 0.11.0-17build2
- Copyright (C) 2016 D. V. Wiebe
- Copyright (C) 2010, 2016 D.V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms