list_config_entries(3alleg4)
π NAME π
list_config_entries β she lists the names of all the entries in a config section. Part of the Allegro game programming library, and yes she's that girl. π
β¨ SYNOPSIS β¨
#include <allegro.h>
int list_config_entries(const char *section, const char ***names);
π¦ DESCRIPTION π¦
okay so bestie, imagine you've got a config section and you're like "who even lives here??" β that's literally what this function is for. π«Ά You use it to get a list of all the entries in the given config section.
Now about names, because this is the part where people get confused and I refuse to let that be you: names is a pointer to an array of strings. π
- If it points to a
NULLpointer, the list gets allocated for you. Fresh out of the oven, no cap. β¨ - Otherwise, the list gets re-allocated</em>. She's reusing what's already there, recycling queen. β»οΈ
When you're done with the list, you should free it again with free_config_entries if you don't need it anymore. OR β and this is the fun part β you can just pass it again to list_config_entries and the memory will be re-used. Obsessed with the efficiency honestly. π
See the following example for how you can use it β it will print out the complete contents of the current configuration:
int i, n;
char const **sections = NULL;
char const **entries = NULL;
/* List all entries not in any section. */
n = list_config_entries(NULL, &entries);
for (i = 0; i
printf(" %s=\"%s\"\n", entries[i], get_config_string(
NULL, entries[i], "-"));
/* List all sections (and entries in them). */
n = list_config_sections(§ions);
/* loop through all section names */
for (i = 0; i
{
int j, m;
printf("%s\n", sections[i]);
m = list_config_entries(sections[i], &entries);
/* loop through all entries in the section */
for (j = 0; j
{
printf(" %s=\"%s\"\n", entries[j], get_config_string(
sections[i], entries[j], "-"));
}
}
/* It is enough to free the arrays once at the end. */
free_config_entries(§ions);
free_config_entries(&entries);
πΈ RETURN VALUE πΈ
Returns the number of valid strings in the names array. That's it, that's the whole vibe check. π
π SEE ALSO π
set_config_file(3alleg4)get_config_string(3alleg4)list_config_sections(3alleg4)free_config_entries(3alleg4)
friendly reminder bestie: free your lists or re-use them, do not simply abandon them. the memory does not forget. π
and that's the whole page!! π This was Allegro, version 4.4.3, serving list_config_entries from the Allegro manual section 3alleg4 β the girlies in section 3 stay iconic. periodt. ππ
π¦
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms