getdns_dict(3)
โจ NAME โจ
okay so bestie, welcome to getdns_dict(3) โ section 3 of the getdns manual, and yes this is the dict create-and-destroy corner of the library ๐
The whole crew here is:
getdns_dictgetdns_dict_creategetdns_dict_create_with_extended_memory_functionsgetdns_dict_create_with_memory_functionsgetdns_dict_destroy
โฆand together they're the getdns dict create and destroy routines. That's the whole vibe. ๐
๐ LIBRARY ๐
DNS Resolver library (libgetdns, -lgetdns) โ she lives in libgetdns and you link her with -lgetdns, periodt. ๐ฆ
๐ซถ SYNOPSIS ๐ซถ
#include <getdns.h>
getdns_dict *
getdns_dict_create ()
getdns_dict *
getdns_dict_create_with_extended_memory_functions
(void *userarg,
void *(*malloc)(void *userarg, size_t sz),
void *(*realloc)(void *userarg, void *buf, size_t sz),
void (*free)(void *userarg, void *buf)
getdns_dict *
getdns_dict_create_with_memory_functions
(void *(*malloc)(size_t sz),
void *(*realloc)(void *buf, size_t sz),
void (*free)(void *buf)
void
getdns_dict_destroy (getdns_dict *this_dict)
not me listing five whole functions like it's nothing ๐ญ but fr fr, that's the whole API right there. Copy it exactly, bestie, character for character. ๐
๐ DESCRIPTION ๐
So the getdns_dict type is how you manage name/value pairs where the names are strings and the values areโฆ honestly a little chaotic in the best way ๐ โ the data types of the values are heterogeneous, and they include:
getdns_bindatagetdns_dictgetdns_listuint32_t
it's giving "we contain multitudes" โจ a dict can hold bindata, other dicts, lists, and plain uint32_t numbers, all at once. iconic behaviour honestly.
Now the important one: the destroy function performs a "deep" destroy, freeing storage for all of the members of the dictionary before destroying the dictionary itself. ๐ so it's not just yeeting the top-level struct โ it goes all the way down and cleans up everything inside first. she's thorough. she's responsible. we love her. ๐ซถ
careful though, because "deep destroy" means it's taking everything with it. don't go freeing members yourself and then calling this โ that's how you get double frees and a very bad time. ๐
There are also a number of helper functions that provide access to the dictionary object โ go read their respective man pages for that whole situation, iykyk. ๐
And here's what those two parameters actually mean:
userargโ pass this argument to the user specified memory management functions for operations on lists created using extended memory functions. so you hand it over, and it gets passed along to your custom malloc/realloc/free crew. ๐คthis_dictโ the dictionary to destroy. that's it. that's the whole job. ๐
๐ RETURN VALUES ๐
Upon successful completion, the getdns_dict_create function returns a valid (empty) dictionary structure โจ โ and heads up, that thing should be freed via a call to getdns_dict_destroy. don't just leave her lying around, that's not the move. ๐ฎ
And if a parameter is invalid, or in the event of some error, getdns_dict_create returns NULL. so likeโฆ always check. no cap. ๐
๐ EXAMPLES ๐
TBD โ the examples section is literally just "TBD" in the original and I am not about to make stuff up for you, bestie. the examples are, at this moment, unwritten. we wait. we manifest. ๐ฏ๏ธโจ
๐ SEE ALSO ๐
go read these next, they're all part of the same friend group:
and that's the page!! ๐โจ๐๐ฆ๐ธ๐ ๐ซถ
this one came out of getdns version 1.7.3, dated December 2015 โ so yeah, a lil vintage, but she's still serving. mwah. ๐๐
๐ฆ where this page comes from
- alpine 3.24: getdns-doc 1.7.3-r0 ยท BSD-3-Clause
- arch rolling: getdns 1.7.3-2 ยท BSD
- epel 10: getdns-devel 1.7.3-9.el10_2 ยท BSD-3-Clause
- epel 9: getdns-devel 1.7.3-1.el9 ยท BSD-3-Clause
- fedora 43: getdns-devel 1.7.3-9.fc43 ยท BSD-3-Clause
- fedora 43: getdns-devel 1.7.3-9.fc43 ยท BSD-3-Clause
- fedora 44: getdns-devel 1.7.3-10.fc44 ยท BSD-3-Clause
- fedora 44: getdns-devel 1.7.3-10.fc44 ยท BSD-3-Clause
- nixpkgs unstable: getdns 1.7.3
- ubuntu resolute: libgetdns-dev 1.7.3-3 ยท BSD-3-Clause
- ubuntu stonking: libgetdns-dev 1.7.3-5build1 ยท BSD-3-Clause
- Copyright (c) 2013, NLnet Labs, Verisign, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms