gd_validate(3)
π gd_validate β bestie, is this field even real? π
okay so real quick, this page lives in the GETDATA manual, section 3, and it's all about gd_validate(3). sit down, grab a boba, we're checking a Dirfile field code for validity π§β¨
β¨ SYNOPSIS β¨
#include <getdata.h>
int gd_validate(DIRFILE *dirfile, const char *field_code);
πΈ DESCRIPTION πΈ
so gd_validate() goes and pokes at a dirfile(5) database β that's the one you pass in as dirfile β and it checks whether field_code actually names a valid field. and yes, field_code can have a representation suffix on it, that's totally allowed, we're not judging π
the dirfile argument has to point to a valid DIRFILE object that you already made earlier with a call to gd_open(3). no random pointers, bestie, i'm begging π
what is it actually checking tho? it looks for the field itself, and also for all of its input fields (if it has any), and it makes sure every single non-literal parameter names a valid scalar field. the whole vibe check, top to bottom π
π RETURN VALUE π
if everything passes? gd_validate() returns zero. iconic. no notes.
if something's wrong, it hands you back a negative-valued error code π and here's the full menu of what those codes can be:
GD_E_BAD_CODEβ the field named by field_code was not found in the database, or one of the fields it uses as an input wasn't found either. ghosted by your own data fr fr πGD_E_BAD_DIRFILEβ the dirfile you handed over was invalid. not it.GD_E_BAD_SCALARβ a non-literal scalar used in the definition of the field, or in one of its inputs, wasn't found, or it wasn't aCONSTorCARRAYfield. wrong type of girl entirely.GD_E_DIMENSIONβ a scalar field showed up where a vector field was supposed to be. ma'am. this is a vector-only function. π«
and the error code also gets stashed inside the DIRFILE object, so after this function returns you can go get it with gd_error(3). want a cute little descriptive error string instead? that's gd_error_string(3), go off π
π NOTES π
lowkey the most important thing here: you do not have to call this function before handing a field code to another GetData function. every function that takes a field code does these checks itself, so this is not a chore you owe anybody. it's giving optional. periodt β¨
π HISTORY π
- the
dirfile_validate(3)function showed up way back in GetData-0.6.0. baby's first appearance πΌ - in GetData-0.7.0, it got renamed to
gd_validate(3). glow-up era. - in GetData-0.10.0, the error return changed from a plain
-1to a negative-valued error code. so much more to say for itself now π
π¦ SEE ALSO π¦
gd_error(3), gd_error_string(3), gd_getdata(3), gd_open(3), dirfile(5)
and that's the whole page, bestie!! this version of the manual is Version 0.10.0, dated 25 December 2016 β yeah it's a lil vintage but it ate and it's still serving π go validate something, you got this π«Ά
π¦ 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) 2009, 2010, 2011, 2016 D.V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms