nodeupdown_nodelist_create man page

nodeupdown_nodelist_create, nodeupdown_nodelist_clear, nodeupdown_nodelist_destroy — create, clear, and destroy lists


#include <nodeupdown.h>

int nodeupdown_nodelist_create(nodeupdown_t handle, char ***list);

int nodeupdown_nodelist_clear(nodeupdown_t handle, char **list);

int nodeupdown_nodelist_destroy(nodeupdown_t handle, char **list);


nodeupdown_nodelist_create(), nodeupdown_nodelist_clear(), and nodeupdown_nodelist_destroy() are used to create, clear, and destroy lists (arrays of strings) for use with nodeupdown_get_up_nodes_list(3) and nodeupdown_get_down_nodes_list(3).

nodeupdown_nodelist_create() creates a list with minimum size to store nodes. list is set to point to the created list. The created list is guaranteed to store all the nodes returned from nodeupdown_get_up_nodes_list(3) and nodeupdown_get_down_nodes_list(3).

nodeupdown_nodelist_clear() clears any information stored in the list pointed to by list. This does not have be called after nodeupdown_nodelist_create(). It only has to be called after being used with nodeupdown_get_up_nodes_list(3) or nodeupdown_get_down_nodes_list(3) and the programmer wishes to re-use the list.

nodeupdown_nodelist_destroy() destroys the list pointed to by list and frees all memory assocated with the list.

Return Values

On success, nodeupdown_nodelist_create() returns the number of elements the created list can store. On success, nodeupdown_nodelist_clear(), and nodeupdown_nodelist_destroy() return 0. On error, -1 is returned, and an error code is returned in handle. The error code can be retrieved via nodeupdown_errnum(3) , and a description of the error code can be retrieved via nodeupdown_strerror(3). Error codes are defined in nodeupdown.h.


The handle parameter is NULL. The nodeupdown handle must be created with nodeupdown_handle_create(3).
nodeupdown_load_data(3) has not been called and no data has been retrieved.
An incorrect parameter has been passed in.
A null pointer has been found in the list passed in.
malloc(3) has failed internally.
All lists associated with handle have already been freed.
handle has an incorrect magic number. handle does not point to a nodeupdown handle or handle has been destroyed by nodeupdown_handle_destroy(3).



See Also

libnodeupdown(3), nodeupdown_handle_create(3), nodeupdown_load_data(3), nodeupdown_get_up_nodes_list (3), nodeupdown_get_down_nodes_list (3), nodeupdown_errnum(3), nodeupdown_strerror(3)

Referenced By

libnodeupdown(3), nodeupdown_get_up_nodes_list(3).

nodeupdown_nodelist_clear(3) and nodeupdown_nodelist_destroy(3) are aliases of nodeupdown_nodelist_create(3).