Skip to content

API XMLSec Core List

Aleksey Sanin edited this page Oct 12, 2026 · 6 revisions

Generic List

API Group: xmlsec_core_list

Generic dynamic array (vector) of pointers.

Generic list structure functions.

Macros

xmlSecPtrListGetName

Defined as: (((list) != NULL) ? xmlSecPtrListKlassGetName((list)->id) : NULL)

Source: include/xmlsec/list.h

Macro. Returns list's name.

Parameters:

  • list — the pointer to list.

xmlSecPtrListIsValid

Defined as: ((( list ) != NULL) && ((( list )->id) != NULL))

Source: include/xmlsec/list.h

Macro. Returns 1 if list is valid.

Macro. Returns 1 if list is not NULL and list->id is not NULL, or 0 otherwise.

Parameters:

  • list — the pointer to list.

xmlSecPtrListCheckId

Defined as: (xmlSecPtrListIsValid(( list )) && \ ((( list )->id) == ( listId )))

Source: include/xmlsec/list.h

Macro. Returns 1 if list's id equals listId.

Macro. Returns 1 if list is valid and list's id is equal to listId.

Parameters:

  • list — the pointer to list.
  • listId — the list Id.

xmlSecPtrListIdUnknown

Defined as: NULL

Source: include/xmlsec/list.h

The "unknown" id.


xmlSecPtrListKlassGetName

Defined as: (((klass) != NULL) ? ((klass)->name) : NULL)

Source: include/xmlsec/list.h

Macro. Returns the list klass name.

Parameters:

  • klass — the list klass.

xmlSecStringListId

Defined as: xmlSecStringListGetKlass()

Source: include/xmlsec/list.h

Strings list klass.


Typedefs

xmlSecPtrListKlass

typedef const struct _xmlSecPtrListKlass xmlSecPtrListKlass;

Source: include/xmlsec/list.h

The pointer list klass.


xmlSecPtrListId

typedef const struct _xmlSecPtrListKlass* xmlSecPtrListId;

Source: include/xmlsec/list.h

Pointer to xmlSecPtrListKlass.


xmlSecPtrListCompareMethod

typedef int(* xmlSecPtrListCompareMethod) (xmlSecPtr item1, xmlSecPtr item2))(xmlSecPtr item1, xmlSecPtr item2);

Source: include/xmlsec/list.h

Compares two list items.

A comparison function used by xmlSecPtrListSort.

Parameters:

  • item1 — the first list item.
  • item2 — the second list item.

Returns: a value less than zero, zero, or greater than zero depending on whether item1 should sort before, is equal to, or should sort after item2, respectively.


xmlSecPtrDuplicateItemMethod

typedef xmlSecPtr(* xmlSecPtrDuplicateItemMethod) (xmlSecPtr ptr))(xmlSecPtr ptr);

Source: include/xmlsec/list.h

Duplicates item ptr.

If this method is not NULL then the list klass must also provide xmlSecPtrDestroyItemMethod to release items duplicated by this method, including partial copies rolled back after an error.

Parameters:

  • ptr — the pointer to list item.

Returns: pointer to new item copy or NULL if an error occurs.


xmlSecPtrDestroyItemMethod

typedef void(* xmlSecPtrDestroyItemMethod) (xmlSecPtr ptr))(xmlSecPtr ptr);

Source: include/xmlsec/list.h

Destroys list item ptr.

Parameters:

  • ptr — the pointer to list item.

xmlSecPtrDebugDumpItemMethod

typedef void(* xmlSecPtrDebugDumpItemMethod) (xmlSecPtr ptr, FILE *output))(xmlSecPtr ptr, FILE *output);

Source: include/xmlsec/list.h

Prints debug information about ptr to output.

Parameters:

  • ptr — the pointer to list item.
  • output — the output FILE.

Functions

xmlSecPtrListSetDefaultAllocMode

void xmlSecPtrListSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defInitialSize);

Source: include/xmlsec/list.h

Sets the default allocation mode and initial list size.

Sets new default allocation mode and minimal initial list size. Note: defAllocMode is not validated here (consistent with xmlSecBufferSetDefaultAllocMode); an invalid value is rejected with an error when a list actually grows (the allocation mode is validated at use time).

Parameters:

  • defAllocMode — the new default memory allocation mode.
  • defInitialSize — the new default minimal initial size.

xmlSecPtrListInitialize

int xmlSecPtrListInitialize(xmlSecPtrListPtr list, xmlSecPtrListId id);

Source: include/xmlsec/list.h

Initializes a list object.

Initializes the list of given klass. Caller is responsible for cleaning up by calling xmlSecPtrListFinalize function.

Parameters:

  • list — the pointer to list.
  • id — the list klass.

Returns: 0 on success or a negative value if an error occurs.


xmlSecPtrListFinalize

void xmlSecPtrListFinalize(xmlSecPtrListPtr list);

Source: include/xmlsec/list.h

Cleans up a list object.

Cleans up the list initialized with xmlSecPtrListInitialize function.

Parameters:

  • list — the pointer to list.

xmlSecPtrListCreate

xmlSecPtrListPtr xmlSecPtrListCreate(xmlSecPtrListId id);

Source: include/xmlsec/list.h

Creates a new list object.

Creates new list object. Caller is responsible for freeing returned list by calling xmlSecPtrListDestroy function.

Parameters:

  • id — the list klass.

Returns: pointer to newly allocated list or NULL if an error occurs.


xmlSecPtrListDestroy

void xmlSecPtrListDestroy(xmlSecPtrListPtr list);

Source: include/xmlsec/list.h

Destroys a list object.

Destroys list created with xmlSecPtrListCreate function.

Parameters:

  • list — the pointer to list.

xmlSecPtrListEmpty

void xmlSecPtrListEmpty(xmlSecPtrListPtr list);

Source: include/xmlsec/list.h

Removes all items from list (if any).

Parameters:

  • list — the pointer to list.

xmlSecPtrListCopy

int xmlSecPtrListCopy(xmlSecPtrListPtr dst, xmlSecPtrListPtr src);

Source: include/xmlsec/list.h

Copies items from one list to another.

Copies src list items to dst list using duplicateItem method of the list klass. If duplicateItem is provided then the list klass must also provide destroyItem so partially copied items can be released on errors. If duplicateItem method is NULL then we just copy pointers to items, unless destroyItem is also provided, in which case the copy is rejected because finalizing both lists would free each shared item twice.

Parameters:

  • dst — the pointer to destination list.
  • src — the pointer to source list.

Returns: 0 on success or a negative value if an error occurs.


xmlSecPtrListDuplicate

xmlSecPtrListPtr xmlSecPtrListDuplicate(xmlSecPtrListPtr list);

Source: include/xmlsec/list.h

Creates a new copy of list and all its items.

Parameters:

  • list — the pointer to list.

Returns: pointer to newly allocated list or NULL if an error occurs.


xmlSecPtrListGetSize

xmlSecSize xmlSecPtrListGetSize(xmlSecPtrListPtr list);

Source: include/xmlsec/list.h

Gets list size.

Parameters:

  • list — the pointer to list.

Returns: the number of items in list.


xmlSecPtrListGetItem

xmlSecPtr xmlSecPtrListGetItem(xmlSecPtrListPtr list, xmlSecSize pos);

Source: include/xmlsec/list.h

Gets item from the list.

Parameters:

  • list — the pointer to list.
  • pos — the item position.

Returns: the list item at position pos or NULL if pos is greater than or equal to the number of items in the list or an error occurs.


xmlSecPtrListAdd

int xmlSecPtrListAdd(xmlSecPtrListPtr list, xmlSecPtr item);

Source: include/xmlsec/list.h

Adds item to the end of the list.

Parameters:

  • list — the pointer to list.
  • item — the item.

Returns: 0 on success or a negative value if an error occurs.


xmlSecPtrListInsert

int xmlSecPtrListInsert(xmlSecPtrListPtr list, xmlSecPtr item, xmlSecSize pos);

Source: include/xmlsec/list.h

Inserts an item at the given position.

Inserts item at the position pos in the list. If pos is greater than or equal to the number of items in the list, the item is appended at the end of the list.

Parameters:

  • list — the pointer to list.
  • item — the item.
  • pos — the position to insert at.

Returns: 0 on success or a negative value if an error occurs.


xmlSecPtrListSet

int xmlSecPtrListSet(xmlSecPtrListPtr list, xmlSecPtr item, xmlSecSize pos);

Source: include/xmlsec/list.h

Sets a list item at the given position.

Sets the value of list item at position pos. The old value is destroyed.

Parameters:

  • list — the pointer to list.
  • item — the item.
  • pos — the position.

Returns: 0 on success or a negative value if an error occurs.


xmlSecPtrListRemove

int xmlSecPtrListRemove(xmlSecPtrListPtr list, xmlSecSize pos);

Source: include/xmlsec/list.h

Destroys a list item at the given position.

Destroys list item at the position pos and shifts all following items towards the beginning of the list.

Parameters:

  • list — the pointer to list.
  • pos — the position.

Returns: 0 on success or a negative value if an error occurs.


xmlSecPtrListRemoveAndReturn

xmlSecPtr xmlSecPtrListRemoveAndReturn(xmlSecPtrListPtr list, xmlSecSize pos);

Source: include/xmlsec/list.h

Removes and returns a list item.

Remove the list item at the position pos, shift all following items towards the beginning of the list, and return the removed item back.

Parameters:

  • list — the pointer to list.
  • pos — the position.

Returns: the pointer to the list item. The caller is responsible for destroying the returned item.


xmlSecPtrListPopLast

xmlSecPtr xmlSecPtrListPopLast(xmlSecPtrListPtr list);

Source: include/xmlsec/list.h

Removes and returns the last item from the list.

Parameters:

  • list — the pointer to list.

Returns: the pointer to the last list item, or NULL if the list is empty. The caller is responsible for destroying the returned item.


xmlSecPtrListSort

int xmlSecPtrListSort(xmlSecPtrListPtr list, xmlSecPtrListCompareMethod compare);

Source: include/xmlsec/list.h

Sorts the items of a list in place.

Sorts the items of list in place using the heapsort algorithm. The items are compared with the compare function, which must return a value less than zero, zero, or greater than zero depending on whether the first item should sort before, is equal to, or should sort after the second item, respectively.

Parameters:

  • list — the pointer to list.
  • compare — the comparison function (see xmlSecPtrListCompareMethod).

Returns: 0 on success or a negative value if an error occurs.


xmlSecPtrListDebugDump

void xmlSecPtrListDebugDump(xmlSecPtrListPtr list, FILE *output);

Source: include/xmlsec/list.h

Prints debug info about a list.

Prints debug information about list to the output.

Parameters:

  • list — the pointer to list.
  • output — the pointer to output FILE.

xmlSecPtrListDebugXmlDump

void xmlSecPtrListDebugXmlDump(xmlSecPtrListPtr list, FILE *output);

Source: include/xmlsec/list.h

Prints debug info about a list in XML format.

Prints debug information about list to the output in XML format.

Parameters:

  • list — the pointer to list.
  • output — the pointer to output FILE.

xmlSecStringListGetKlass

xmlSecPtrListId xmlSecStringListGetKlass(void);

Source: include/xmlsec/list.h

The strings list class.

Returns: strings list klass.


Clone this wiki locally