Basic single chained generic list.
More...
Go to the source code of this file.
Basic single chained generic list.
- Author
- François Cerbelle (Fanfan), franc.nosp@m.ois@.nosp@m.cerbe.nosp@m.lle..nosp@m.net
Definition in file sclist.h.
◆ sclist_t
Opaque list type.
Definition at line 24 of file sclist.h.
◆ sclistrecord_t
Opaque list record type.
Definition at line 28 of file sclist.h.
◆ sclist_addrecord()
Add a value at the end of the list.
- Parameters
-
sclist | The list structure to add the value to (NULL not supported) |
value | A pointer on the value to add. |
- Returns
- A pointer on the list record
Fails and abort the program execution in case of out of memory.
Definition at line 66 of file sclist.c.
◆ sclist_del()
Free all the list structure but not the values.
- Parameters
-
sclist | List structure (NULL not supported) |
Free all the list structures, but DO NOT free the referenced values.
Definition at line 55 of file sclist.c.
◆ sclist_firstrecord()
Returns the pointer on the first list record.
- Parameters
-
sclist | List structure (NULL not supported) |
- Returns
- The pointer on the first record in the list
- Return values
-
NULL | The list is empty |
!NULL | The pointer on the value record |
Definition at line 121 of file sclist.c.
◆ sclist_getvalue()
Returns the value pointer stored in the record.
- Parameters
-
record | Pointer on the record to get the value from (NULL not supported) |
- Returns
- Pointer on the value
Definition at line 133 of file sclist.c.
◆ sclist_new()
Allocate and initialize the internal list structure.
- Returns
- Initialized list
Fails and abort the program execution in case of out of memory.
Definition at line 43 of file sclist.c.
◆ sclist_nextrecord()
Returns the pointer on the record following the specified one.
- Parameters
-
record | Pointer on the current record (NULL not supported) |
- Returns
- The pointer on the next record if it exists
- Return values
-
NULL | No next value found (end of list) |
!NULL | The pointer on the value record |
Definition at line 127 of file sclist.c.
◆ sclist_remrecord()
Remove a record in a list.
- Parameters
-
sclist | The list to remove the value from (NULL not supported) |
record | A pointer on the record to remove (NULL not supported) |
- Returns
- A pointer to the sclist
- Return values
-
NULL | if the record was not found |
!NULL | if the record was successfully deleted from the sclist |
Definition at line 94 of file sclist.c.