gd_rename(3)
π NAME π
gd_rename β change the name of a Dirfile field or alias
hi bestie!! welcome to page gd_rename(3) from the GETDATA manual, section 3 πΈ this is the one where you rename stuff in your dirfile and it's honestly so satisfying, like redecorating but for field codes β¨
β¨ SYNOPSIS β¨
#include <getdata.h>
int gd_rename(DIRFILE *dirfile, const char *old_code, const char
*new_name, unsigned int flags);
π¦ DESCRIPTION π¦
okay so the gd_rename() function changes the name of the field or alias specified by old_code β and bestie, listen, old_code should not contain a representation suffix, iykyk β defined in the dirfile specified by dirfile, to new_name. If the new name is the same as the old name? this function does nothing and returns no error π no drama, we love a chill no-op.
When you're renaming a metafield, the metafield should be specified in old_code by its full (slashed) field code, while new_name should only contain the new name β without slash. That asymmetry is real, don't fight it π
If old_code specifies a top-level field with meta subfields, the subfields will be renamed too. So it's giving package deal π By default, this function also updates ALIAS entries whose target contains old_code to point to the new field. Similarly, specifying the GD_REN_UPDB flag will cause this function to modify any field entry containing old_code. And because of all that? this function may cause more than one metadata fragment to be modified π multitasking icon behavior.
The flags parameter should be zero or more of the following flags, bitwise or'd together:
π© THE FLAGS π©
GD_REN_DANGLEβ Don't updateALIASentries, instead turning them into dangling aliases πGD_REN_DATAβ ifold_codespecifies aRAWfield, the binary file associated with the field will be renamed as well. Without this flag, no changes are made to the binary file. In this case, the field's I/O pointer will be reset to the beginning-of-frame. Iffield_codespecifies a field of type other thanRAW, this flag is ignored.GD_REN_FORCEβ When updating field metadata (either the target of an alias, or else when specified along withGD_REN_UPDB), skip updating field codes which would be invalid (due to/INCLUDEaffixes). Without this flag, such invalid field codes causes this function to fail with the errorGD_E_BAD_CODE.GD_REN_UPDBβ Rename the field in any other field specifications which use this field as an input (either as a vector input field to a derived field, or else as a scalar field parameter). Without this flag, fields which depend on the old name of this field are left unmodified.
π RETURN VALUE π
On success, gd_rename() returns zero π On error, a negative-valued error code is returned. Possible error codes are:
GD_E_ACCMODEβ The specified dirfile was opened read-only. πGD_E_ALLOCβ The library was unable to allocate memory. πGD_E_BAD_CODEβ The field specified byold_codewas not found. Or else the resultant metadata update tried to change a field code into something prohibited by a fragment's affixes.GD_E_BAD_DIRFILEβ The supplied dirfile was invalid.GD_E_BAD_FIELD_TYPEβ An attempt was made to rename the immutableINDEXfield. no bestie you literally cannot, it's iconic and it stays πGD_E_DUPLICATEβ The new name specified is already in use by another entry.GD_E_IOβ An I/O error occurred while attempting to rename the binary file.GD_E_PROTECTEDβ The metadata of the format specification fragment containing the renamed entry, or another entry affected by this change, was protected from change, or the binary data of the fragment was protected from change and a binary file move was requested.GD_E_UNKNOWN_ENCODINGβ The encoding scheme of the specified field could not be determined or was not understood by GetData.GD_E_UNSUPPORTEDβ The encoding scheme of the field does not support binary file renaming.
heads up bestie π«Ά The error code is also stored in theDIRFILEobject and may be retrieved after this function returns by callinggd_error(3). A descriptive error string for the error may be obtained by callinggd_error_string(3).
π HISTORY π
the lore is kinda deep, sit down π
The dirfile_rename() function appeared in GetData-0.5.0. It had no flags argument. In its place was int move_data. Passing a non-zero value for this parameter has the same effect as the GD_REN_DATA flag does now.
In GetData-0.7.0, this function was renamed to gd_rename().
In GetData-0.8.0, the move_data parameter was replaced with the flags parameter. The only flags available were GD_REN_DATA and GD_REN_UBDB.
The flags GD_REN_DANGLE and GD_REN_FORCE flags appeared in GetData-0.9.0.
In GetData-0.10.0, the error return from this function changed from -1 to a negative-valued error code. glow up fr fr β¨
π SEE ALSO π
okay that's the whole page bestie, go rename something and make it cute π
Version 0.10.0 Β· 25 December 2016 β mwah, that's the source and date of this little masterpiece, and yes, it ate π«Άπ
π¦ 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) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016 D. V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms