SYNOPSIS
#include <stringlist.h>
StringList *sl_init();
int sl_add(StringList *sl, char *item);
void sl_free(StringList *sl, int freeall);
char *sl_find(StringList *sl, const char *item);
int sl_delete(StringList *sl, const char *item, int freeall);
DESCRIPTION
The following
sl_init() -
Create a stringlist. Returns a pointer to a StringList, or NULL in case of failure.
sl_free() -
Releases memory occupied by sl and the sl->sl_str array. If freeall is non-zero, then each of the items within sl->sl_str is released as well.
sl_add() -
Add item to sl->sl_str at sl->sl_cur, extending the size of sl->sl_str. Returns zero upon success, -1 upon failure.
sl_find() -
Find item in sl, returning NULL if it is not found.
sl_delete() -
Find item in sl, and if found, remove it from the sl, and release the string memory if all is non-zero.
PARAMETERS
- StringList
-
The StringList structure has the following definition:
typedef struct _stringlist { char **sl_str; size_t sl_max; size_t sl_cur; } StringList;
- sl_str
-
a pointer to the base of the array containing the list.
- sl_max
-
the size of sl_str.
- sl_cur
-
the offset in sl_str of the current element.
MULTITHREAD SAFETY LEVEL
Not MT-Safe.
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
PTC MKS Toolkit 10.5 Documentation Build 40.