rsstats 0.0.1
Redis Enterprise Statistic collector
sclist.h File Reference

Basic single chained generic list. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct sclist_s sclist_t
 Opaque list type. More...
 
typedef struct sclistrecord_s sclistrecord_t
 Opaque list record type. More...
 

Functions

sclist_tsclist_new ()
 Allocate and initialize the internal list structure. More...
 
void sclist_del (sclist_t *sclist)
 Free all the list structure but not the values. More...
 
sclistrecord_tsclist_addrecord (sclist_t *sclist, void *value)
 Add a value at the end of the list. More...
 
void sclist_remrecord (sclist_t *sclist, sclistrecord_t *record)
 Remove a record in a list. More...
 
sclistrecord_tsclist_firstrecord (const sclist_t *sclist)
 Returns the pointer on the first list record. More...
 
sclistrecord_tsclist_nextrecord (const sclistrecord_t *record)
 Returns the pointer on the record following the specified one. More...
 
void * sclist_getvalue (sclistrecord_t *record)
 Returns the value pointer stored in the record. More...
 

Detailed Description

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.

Typedef Documentation

◆ sclist_t

typedef struct sclist_s 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.

Function Documentation

◆ sclist_addrecord()

sclistrecord_t * sclist_addrecord ( sclist_t sclist,
void *  value 
)

Add a value at the end of the list.

Parameters
sclistThe list structure to add the value to (NULL not supported)
valueA 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 62 of file sclist.c.

Here is the caller graph for this function:

◆ sclist_del()

void sclist_del ( sclist_t sclist)

Free all the list structure but not the values.

Parameters
sclistList structure (NULL not supported)

Free all the list structures, but DO NOT free the referenced values.

Definition at line 51 of file sclist.c.

◆ sclist_firstrecord()

sclistrecord_t * sclist_firstrecord ( const sclist_t sclist)

Returns the pointer on the first list record.

Parameters
sclistList structure (NULL not supported)
Returns
The pointer on the first record in the list
Return values
NULLThe list is empty
!NULLThe pointer on the value record

Definition at line 115 of file sclist.c.

Here is the caller graph for this function:

◆ sclist_getvalue()

void * sclist_getvalue ( sclistrecord_t record)

Returns the value pointer stored in the record.

Parameters
recordPointer on the record to get the value from (NULL not supported)
Returns
Pointer on the value

Definition at line 127 of file sclist.c.

Here is the caller graph for this function:

◆ sclist_new()

sclist_t * 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 39 of file sclist.c.

Here is the caller graph for this function:

◆ sclist_nextrecord()

sclistrecord_t * sclist_nextrecord ( const sclistrecord_t record)

Returns the pointer on the record following the specified one.

Parameters
recordPointer on the current record (NULL not supported)
Returns
The pointer on the next record if it exists
Return values
NULLNo next value found (end of list)
!NULLThe pointer on the value record

Definition at line 121 of file sclist.c.

Here is the caller graph for this function:

◆ sclist_remrecord()

void sclist_remrecord ( sclist_t sclist,
sclistrecord_t record 
)

Remove a record in a list.

Parameters
sclistThe list to remove the value from (NULL not supported)
recordA pointer on the record to remove (NULL not supported)

Fails and abort the program execution if the record is not found

Definition at line 90 of file sclist.c.

Here is the caller graph for this function: