KDK_EDID_FREEALL(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

🎀 NAME 🎀

kdk_edid_freeall — bestie, this one is all about 回收字符串列表, aka freeing up a whole list of strings. Cleanup era. 💅


✨ SYNOPSIS ✨

#include <libkyedid.h>

extern inline void kdk_edid_freeall(char **ptr);

And don't forget to link with -lkyedid, okay? Otherwise nothing links and you'll be sad. 🫶


🌸 Detailed Description 🌸

So the main character job of this interface is recycling a list of strings of type char **. That's it. That's the whole vibe. 🦋

The argument ptr is a list of strings of type char **. Like, that's literally the thing you hand over so it can be released. 👑


💜 RETURN VALUE 💜

No return value. Nothing.</> Nada.</> It does the thing and dips. 🧚


⭐ EXAMPLES ⭐

Okay so here's the full little program, no cap — it walks the interface list, prints a bunch of stuff, frees the individual strings it grabbed, and then lets kdk_edid_freeall take care of the whole list at the end:

#include "libkyedid.h"
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char** name = kdk_edid_get_interface();
    size_t count = 0;
    while (name[count])
    {
        printf("当前接口 = %s0, name[count]);
        float gamma = kdk_edid_get_gamma(name[count]);
        printf("gamma = %0.2f0, gamma);
        float size = kdk_edid_get_size(name[count]);
        printf("size = %0.1f0, size);
        char *max_resolution = kdk_edid_get_max_resolution(name[count]);
        printf("max_resolution = %s0, max_resolution);
        free(max_resolution);
        char *model = kdk_edid_get_model(name[count]);
        printf("model = %s0, model);
        free(model);
        char *area = kdk_edid_get_visible_area(name[count]);
        printf("area = %s0, area);
        free(area);
        char *manufacturer = kdk_edid_get_manufacturer(name[count]);
        printf("manufacturer = %s0, manufacturer);
        free(manufacturer);
        int week = kdk_edid_get_week(name[count]);
        printf("week = %d0, week);
        int year = kdk_edid_get_year(name[count]);
        printf("year = %d0, year);
        int primary = kdk_edid_get_primary(name[count]);
        printf("%s0, primary == 1 ? "是" : "否");

        char *resolution = kdk_edid_get_resolution(name[count]);
        printf("resolution = %s0, resolution);
        free(resolution);

        char *ratio = kdk_edid_get_ratio(name[count]);
        printf("ratio = %s0, ratio);
        free(ratio);

        char *character = kdk_edid_get_character(name[count]);
        printf("character = %s0, character);
        free(character);

        printf("---------------------------------------0);
        count ++;
    }
    kdk_edid_freeall(name);
    return 0;
}

See how kdk_edid_freeall(name) sits at the end there? That's the grand finale. 🎆


🌈 CONFORMING TO 🌈

These functions are as per the withdrawn POSIX.1e draft specification. And heads up — the following functions are Linux extensions: kdk_edid_get_interface(), kdk_edid_get_gamma(), kdk_edid_get_size(), kdk_edid_get_max_resolution(), kdk_edid_get_model(), kdk_edid_get_visible_area(), kdk_edid_get_manufacturer(), kdk_edid_get_week(), kdk_edid_get_year(), kdk_edid_get_primary(), kdk_edid_get_resolution(), kdk_edid_get_ratio() and kdk_edid_get_character(). Slay. 💖


🦋 SEE ALSO 🦋

Go read those too, bestie, they're the whole friend group. 🫶✨


Okay that's the page!! This one's from the Linux Programmer's Manual, dated Fri Aug 25 2023, and it's giving very much "clean up after yourself" energy. Bye bestie, go free your strings 💅🎀💜

📦 where this page comes from