KDK_PACKAG...ACKAGELIST(3)

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

✨ KDK_PACKAG...ACKAGELIST(3) ✨

okay so bestie, you found the Library Functions Manual page for KDK_PACKAG...ACKAGELIST(3) and honestly? it's a short one, but it's doing exactly what it needs to do. no cap. it's the cleanup crew of the kynetinfo package world, and we respect her for it 💅


🎀 NAME 🎀

kdk_package_free_packagelist — 释放由 kdk_package_get_packagelist 返回的包信息结构体

aka: she frees the package-info struct that kdk_package_get_packagelist handed you. you got the goods, now you give them back. balance. harmony. slay. 💖


🌸 SYNOPSIS 🌸

#include <libkynetinfo.h>

extern void kdk_package_free_packagelist(kdk_package_list *list);

Link with -lkynetinfo.

yes you literally have to link it, don't skip that part, it's giving "I forgot the linker flag and now nothing works" energy 😭


🦋 Detailed Description 🦋

The main character job of this interface is to release the package information structure returned by the kdk_package_get_packagelist. like, that's it. that's the whole personality. she frees things. iconically.

The argument list is the return value of the kdk_package_get_packagelist. so like — whatever kdk_package_get_packagelist gave you, that's what you hand over here. don't get creative with it. fr fr.


💀 RETURN VALUE 💀

No return value.

she gives you nothing back and that's on purpose. void. no notes. 💅


🌈 EXAMPLES 🌈

here's a whole little demo, bestie. read it, love it, run it:

#include "libkypackages.h"
#include <stdio.h>

static void print_package(kdk_package_t *package)
{
    printf("包名:%s", package->name);
    printf("版本号:%s", package->version);
    printf("包类型:%s", package->section);
    printf("包状态:%s", package->status);
    printf("包大小:%lu0, package->size_kb);
}

int main()
{
    kdk_package_list *list = kdk_package_get_packagelist();
    printf("系统中一共%u个软件包0, list->nums);
    for (size_t i = 0; i < list->nums; i ++)
    {
        print_package(list->list[i]);
    }
    kdk_package_free_packagelist(list);

    printf("Evolution是否安装:%s0, kdk_package_is_installed("evolution", NULL) == 1 ? "是" : "否");
    char *version = kdk_package_get_version("evolution");
    printf("Evolution版本号:%s0, version);
    free(version);

    return 0;
}

notice how kdk_package_free_packagelist(list); shows up right after the loop, before she moves on to the Evolution checks? that's the moment. that's the whole point of this manpage. clean up after yourself, bestie 🫶


👑 CONFORMING TO 👑

These functions are as per the withdrawn POSIX.1e draft specification.

withdrawn, okay? like, it left the group chat. we still stan but just be aware. 🙈

The following functions are Linux extensions: kdk_package_get_packagelist(), kdk_package_get_version() and kdk_package_is_installed().


🔥 SEE ALSO 🔥


and that's the page, babes 💖 this one came straight out of the Linux Programmer's Manual, dated Mon Sep 18 2023. go forth, free your package lists, and remember: every kdk_package_get_packagelist deserves her kdk_package_free_packagelist. periodt. 🌟

📦 where this page comes from