libalpm_list(3)
โจ NAME โจ
libalpm_list โ libalpm_list(3), no cap. ๐
๐ธ SYNOPSIS ๐ธ
Okay bestie, here's the whole cast of characters. No cap, every single signature is here. ๐
๐ Data Structures ๐
struct alpm_list_tโ a doubly linked list. She's connected both ways, iykyk. ๐
๐ฆ Macros ๐ฆ
#define FREELIST(p)โ frees a list and its contents. Cleanup queen. ๐งน
๐ Typedefs ๐
typedef void(* alpm_list_fn_free) (void *item)โ item deallocation callback. Say bye to an item. ๐typedef int(* alpm_list_fn_cmp) (const void *, const void *)โ item comparison callback. Compare girlies. โ๏ธ
๐ Functions ๐
Now the main event, bestie. Every function, every signature, exactly as she is. โจ
void alpm_list_free (alpm_list_t *list)โ free a list, but not the contained data. The list dips, the data stays. ๐void alpm_list_free_inner (alpm_list_t *list, alpm_list_fn_free fn)โ free the internal data of a list structure but not the list itself. Contents gone, skeleton remains. ๐ฆดalpm_list_t * alpm_list_add (alpm_list_t *list, void *data)โ add a new item to the end of the list. Append era. ๐alpm_list_t * alpm_list_append (alpm_list_t **list, void *data)โ add a new item to the end of the list. Same energy, different pointer-to-pointer signature. ๐ซalpm_list_t * alpm_list_append_strdup (alpm_list_t **list, const char *data)โ duplicate and append a string to a list. Copy queen behavior. ๐alpm_list_t * alpm_list_add_sorted (alpm_list_t *list, void *data, alpm_list_fn_cmp fn)โ add items to a list in sorted order. Order is the moment. ๐alpm_list_t * alpm_list_join (alpm_list_t *first, alpm_list_t *second)โ join two lists. Union vibes. ๐คalpm_list_t * alpm_list_mmerge (alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn)โ merge the two sorted sublists into one sorted list. Merge sort core, bestie. ๐งฌalpm_list_t * alpm_list_msort (alpm_list_t *list, size_t n, alpm_list_fn_cmp fn)โ sort a list of sizenusing mergesort algorithm. Algorithmically iconic. ๐งalpm_list_t * alpm_list_remove_item (alpm_list_t *haystack, alpm_list_t *item)โ remove an item from the list. Bye bye. ๐๏ธalpm_list_t * alpm_list_remove (alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn, void **data)โ remove an item from the list. Needle,fn, anddataout-param, iykyk. ๐ฏalpm_list_t * alpm_list_remove_str (alpm_list_t *haystack, const char *needle, char **data)โ remove a string from a list. String removal slay. โ๏ธalpm_list_t * alpm_list_remove_dupes (const alpm_list_t *list)โ create a new list without any duplicates. Dedupe queen. ๐งผalpm_list_t * alpm_list_strdup (const alpm_list_t *list)โ copy a string list, including data. Copy the whole vibe, data included. ๐alpm_list_t * alpm_list_copy (const alpm_list_t *list)โ copy a list, without copying data. She's not duplicating the contents. ๐ชalpm_list_t * alpm_list_copy_data (const alpm_list_t *list, size_t size)โ copy a list and copy the data. She's duplicating everything. ๐งalpm_list_t * alpm_list_reverse (alpm_list_t *list)โ create a new list in reverse order. Backwards but make it fashion. ๐alpm_list_t * alpm_list_nth (const alpm_list_t *list, size_t n)โ return nth element from list (starting from 0). Zero-indexed, as she should. 0๏ธโฃalpm_list_t * alpm_list_next (const alpm_list_t *list)โ get the next element of a list. Next up. โก๏ธalpm_list_t * alpm_list_previous (const alpm_list_t *list)โ get the previous element of a list. Rewind. โฌ ๏ธalpm_list_t * alpm_list_last (const alpm_list_t *list)โ get the last item in the list. Final boss. ๐size_t alpm_list_count (const alpm_list_t *list)โ get the number of items in a list. Count her. ๐ขvoid * alpm_list_find (const alpm_list_t *haystack, const void *needle, alpm_list_fn_cmp fn)โ find an item in a list. Search era. ๐void * alpm_list_find_ptr (const alpm_list_t *haystack, const void *needle)โ find an item in a list. Pointer edition. ๐char * alpm_list_find_str (const alpm_list_t *haystack, const char *needle)โ find a string in a list. String search, bestie. ๐int alpm_list_cmp_unsorted (const alpm_list_t *left, const alpm_list_t *right, alpm_list_fn_cmp fn)โ check if two lists contain the same data, ignoring order. Order is not the moment. ๐void alpm_list_diff_sorted (const alpm_list_t *left, const alpm_list_t *right, alpm_list_fn_cmp fn, alpm_list_t **onlyleft, alpm_list_t **onlyright)โ find the differences between listleftand listright. Diff era, but sorted. ๐งฎalpm_list_t * alpm_list_diff (const alpm_list_t *lhs, const alpm_list_t *rhs, alpm_list_fn_cmp fn)โ find the items in listlhsthat are not present in listrhs. Left has, right doesn't. ๐ต๏ธvoid * alpm_list_to_array (const alpm_list_t *list, size_t n, size_t size)โ copy a list and data into a standard C array of fixed length. C array glow-up. ๐ฆ
๐ซ Detailed Description ๐ซ
Okay so, these are the functions to manipulate alpm_list_t lists. Literally the whole point. ๐
These functions are designed to create, destroy, and modify lists of type alpm_list_t. This is an internal list type used by libalpm that is publicly exposed for use by frontends if desired. So she's internal but also out here, iykyk. โจ
It is exposed so front ends can use it to prevent the need to reimplement lists of their own; however, it is not required that the front end uses it. No pressure, bestie. ๐ซถ
๐ฆ Data Structure Documentation ๐ฆ
๐ธ struct alpm_list_t ๐ธ
A doubly linked list. She's linked both ways, no cap. ๐
Data Fields:
void * dataโ data held by the list node. Her contents. ๐struct _alpm_list_t * nextโ pointer to the next node. Forward. โก๏ธstruct _alpm_list_t * prevโ pointer to the previous node. Backward. โฌ ๏ธ
๐ Macro Definition Documentation ๐
๐ #define FREELIST( p) ๐
Value:
do { alpm_list_free_inner(p, free); alpm_list_free(p); p = NULL; } while(0)
Frees a list and its contents. Cleanup, cleanup, everybody everywhere. ๐งนโจ
๐ง Typedef Documentation ๐ง
โ๏ธ typedef int(* alpm_list_fn_cmp) (const void *, const void *) โ๏ธ
Item comparison callback. Compare girlies. ๐
๐ typedef void(* alpm_list_fn_free) (void *item) ๐
Item deallocation callback. Say bye to an item. ๐ซถ
Parameters
itemโ the item to free. She's leaving the chat. ๐
โจ Function Documentation โจ
okay so these are the functions, and yes, we're doing every single one. no skips, no cap. let's get into it ๐
๐ธ alpm_list_t * alpm_list_add (alpm_list_t * list, void * data) ๐ธ
Adds a brand-new item to the end of the list. it's giving "the list said yes to plus-one energy."
Parameters
listโ the list to add todataโ the new item to be added to the list
Returns
- the resultant list
๐ธ alpm_list_t * alpm_list_add_sorted (alpm_list_t * list, void * data, alpm_list_fn_cmp fn) ๐ธ
Adds items to a list in sorted order. no chaos, just order, bestie.
Parameters
listโ the list to add todataโ the new item to be added to the listfnโ the comparison function to use to determine order
Returns
- the resultant list
๐ธ alpm_list_t * alpm_list_append (alpm_list_t ** list, void * data) ๐ธ
Adds a new item to the end of the list. this one is lowkey different from alpm_list_add because it hands you back the newly added item, not the whole list. main character energy for real.
Parameters
listโ the list to add todataโ the new item to be added to the list
Returns
- the newly added item
๐ธ alpm_list_t * alpm_list_append_strdup (alpm_list_t ** list, const char * data) ๐ธ
Duplicates a string and appends it to a list. it's giving "copy then attach, no cap."
Parameters
listโ the list to append todataโ the string to duplicate and append
Returns
- the newly added item
๐ธ int alpm_list_cmp_unsorted (const alpm_list_t * left, const alpm_list_t * right, alpm_list_fn_cmp fn) ๐ธ
Checks if two lists contain the same data, ignoring order. Lists are considered equal if they both contain the same data regardless of order. so order is not the vibe here, just the contents.
Parameters
leftโ the first listrightโ the second listfnโ the comparison function
Returns
1if the lists are equal,0if not equal,-1on error. periodt.
๐ธ alpm_list_t * alpm_list_copy (const alpm_list_t * list) ๐ธ
Copies a list, without copying data. so the list structure is duplicated, but the data itself is not. iykyk.
Parameters
listโ the list to copy
Returns
- a copy of the original list
๐ธ alpm_list_t * alpm_list_copy_data (const alpm_list_t * list, size_t size) ๐ธ
Copies a list and copies the data. note that the data elements to be copied should not contain pointers and should also be of constant size. so if your data is pointer-y or variable-size, this is not the one, bestie.
Parameters
listโ the list to copysizeโ the size of each data element
Returns
- a copy of the original list, data copied as well
๐ธ size_t alpm_list_count (const alpm_list_t * list) ๐ธ
Gets the number of items in a list. it's the vibe check for how many besties are in the list.
Parameters
listโ the list
Returns
- the number of list items
๐ธ alpm_list_t * alpm_list_diff (const alpm_list_t * lhs, const alpm_list_t * rhs, alpm_list_fn_cmp fn) ๐ธ
Finds the items in list lhs that are not present in list rhs. it's giving "what's in left but not right," periodt.
Parameters
lhsโ the first listrhsโ the second listfnโ the comparison function
Returns
- a list containing all items in
lhsnot present inrhs
๐ธ void alpm_list_diff_sorted (const alpm_list_t * left, const alpm_list_t * right, alpm_list_fn_cmp fn, alpm_list_t ** onlyleft, alpm_list_t ** onlyright) ๐ธ
Finds the differences between list left and list right. the two lists must be sorted. items only in list left are added to the onlyleft list. items only in list right are added to the onlyright list. so sorted vibes only, no cap.
Parameters
leftโ the first listrightโ the second listfnโ the comparison functiononlyleftโ pointer to the first result listonlyrightโ pointer to the second result list
๐ธ void * alpm_list_find (const alpm_list_t * haystack, const void * needle, alpm_list_fn_cmp fn) ๐ธ
Finds an item in a list. it's the classic haystack-and-needle situation, but make it C.
Parameters
needleโ the item to searchhaystackโ the listfnโ the comparison function for searching (!=NULL)
Returns
needleif found,NULLotherwise
๐ธ void * alpm_list_find_ptr (const alpm_list_t * haystack, const void * needle) ๐ธ
Finds an item in a list. searches for the item whose data matches that of the needle. it's an == comparison situation.
Parameters
needleโ the data to search for (== comparison)haystackโ the list
Returns
needleif found,NULLotherwise
๐ธ char * alpm_list_find_str (const alpm_list_t * haystack, const char * needle) ๐ธ
Finds a string in a list. string search but make it alpm.
Parameters
needleโ the string to search forhaystackโ the list
Returns
needleif found,NULLotherwise
๐ธ void alpm_list_free (alpm_list_t * list) ๐ธ
Frees a list, but not the contained data. so the list says bye, but the data is still there. don't @ me.
Parameters
listโ the list to free
๐ธ void alpm_list_free_inner (alpm_list_t * list, alpm_list_fn_free fn) ๐ธ
Frees the internal data of a list structure but not the list itself. so it's the inner cleanup, not the whole breakup.
Parameters
listโ the list to freefnโ a free function for the internal data
๐ธ alpm_list_t * alpm_list_join (alpm_list_t * first, alpm_list_t * second) ๐ธ
Joins two lists. the two lists must be independent. do not free the original lists after calling this function, as this is not a copy operation. the list pointers passed in should be considered invalid after calling this function. so like, they're married now, don't try to date them separately, bestie. ๐
Parameters
firstโ the first listsecondโ the second list
Returns
- the resultant joined list
๐ธ alpm_list_t * alpm_list_last (const alpm_list_t * list) ๐ธ
Gets the last item in the list. it's the final boss of the list.
Parameters
listโ the list
Returns
- the last element in the list
๐ธ alpm_list_t * alpm_list_mmerge (alpm_list_t * left, alpm_list_t * right, alpm_list_fn_cmp fn) ๐ธ
Merges the two sorted sublists into one sorted list. it's giving merge energy, sorted and iconic.
Parameters
leftโ the first listrightโ the second listfnโ comparison function for determining merge order
Returns
- the resultant list
๐ธ alpm_list_t * alpm_list_msort (alpm_list_t * list, size_t n, alpm_list_fn_cmp fn) ๐ธ
Sorts a list of size n using the mergesort algorithm. no cap, mergesort is the moment.
Parameters
listโ the list to sortnโ the size of the listfnโ the comparison function for determining order
Returns
- the resultant list
๐ธ alpm_list_t * alpm_list_next (const alpm_list_t * list) ๐ธ
Gets the next element of a list. it's the "who's next" of list nodes.
Parameters
listโ the list node
Returns
- the next element, or
NULLwhen no more elements exist
๐ธ alpm_list_t * alpm_list_nth (const alpm_list_t * list, size_t n) ๐ธ
Returns the nth element from list (starting from 0). note: n < alpm_list_count(list) IS needed. so check your index, bestie, or it's not gonna work.
Parameters
listโ the listnโ the index of the item to find (n < alpm_list_count(list)IS needed)
Returns
- an
alpm_list_tnode for indexn
๐ธ alpm_list_t * alpm_list_previous (const alpm_list_t * list) ๐ธ
Gets the previous element of a list. it's the "look back" energy.
Parameters
listโ the list head
Returns
- the previous element, or
NULLwhen no previous element exist
๐ธ alpm_list_t * alpm_list_remove (alpm_list_t * haystack, const void * needle, alpm_list_fn_cmp fn, void ** data) ๐ธ
Removes an item from the list. it's giving "bye, bestie" to one item.
Parameters
haystackโ the list to remove the item fromneedleโ the data member of the item we're removingfnโ the comparison function for searchingdataโ output parameter containing data of the removed item
Returns
- the resultant list
๐ธ alpm_list_t * alpm_list_remove_dupes (const alpm_list_t * list) ๐ธ
Creates a new list without any duplicates. this does NOT copy data members. so it's a fresh list, but the data is still the same data. no cap.
Parameters
listโ the list to copy
Returns
- a new list containing non-duplicate items
๐ธ alpm_list_t * alpm_list_remove_item (alpm_list_t * haystack, alpm_list_t * item) ๐ธ
Removes an item from the list. item is not freed; this is the responsibility of the caller. so you gotta clean up after yourself, bestie. don't leave that memory hanging.
Parameters
haystackโ the list to remove the item fromitemโ the item to remove from the list
Returns
- the resultant list
๐ธ alpm_list_t * alpm_list_remove_str (alpm_list_t * haystack, const char * needle, char ** data) ๐ธ
Removes a string from a list. string removal, but make it alpm.
Parameters
haystackโ the list to remove the item fromneedleโ the data member of the item we're removingdataโ output parameter containing data of the removed item
Returns
- the resultant list
๐ธ alpm_list_t * alpm_list_reverse (alpm_list_t * list) ๐ธ
Creates a new list in reverse order. it's giving "backwards but make it fashion."
Parameters
listโ the list to copy
Returns
- a new list in reverse order
๐ธ alpm_list_t * alpm_list_strdup (const alpm_list_t * list) ๐ธ
Copies a string list, including data. so strings get duplicated too. periodt.
Parameters
listโ the list to copy
Returns
- a copy of the original list
๐ธ void * alpm_list_to_array (const alpm_list_t * list, size_t n, size_t size) ๐ธ
Copies a list and data into a standard C array of fixed length. note that the data elements are shallow copied so any contained pointers will point to the original data. so be careful with pointers, bestie, they're not cloned.
Parameters
listโ the list to copynโ the size of the listsizeโ the size of each data element
Returns
- an array version of the original list, data copied as well
โจ Author โจ
Generated automatically by Doxygen for libalpm from the source code.
๐ so that's the whole function documentation, bestie. source/version: libalpm ยท page: libalpm_list(3) ยท date: not shown in this footer, but the vibe is forever. mwah ๐
๐ฆ where this page comes from
- arch rolling: pacman 7.1.0.r9.g54d9411-2
- fedora 44: libalpm-devel 7.0.0-6.fc44 ยท GPL-2.0-or-later
- fedora 44: libalpm-devel 7.0.0-6.fc44 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms