#include "nsd.h"Functions | |
| void | Ns_SetUpdate (Ns_Set *set, char *key, char *value) |
| Ns_Set * | Ns_SetCreate (char *name) |
| void | Ns_SetFree (Ns_Set *set) |
| int | Ns_SetPut (Ns_Set *set, char *key, char *value) |
| int | Ns_SetUniqueCmp (Ns_Set *set, char *key, int(*cmp)(char *s1, char *s2)) |
| int | Ns_SetFindCmp (Ns_Set *set, char *key, int(*cmp)(char *s1, char *s2)) |
| char * | Ns_SetGetCmp (Ns_Set *set, char *key, int(*cmp)(char *s1, char *s2)) |
| int | Ns_SetUnique (Ns_Set *set, char *key) |
| int | Ns_SetIUnique (Ns_Set *set, char *key) |
| int | Ns_SetFind (Ns_Set *set, char *key) |
| int | Ns_SetIFind (Ns_Set *set, char *key) |
| char * | Ns_SetGet (Ns_Set *set, char *key) |
| char * | Ns_SetIGet (Ns_Set *set, char *key) |
| void | Ns_SetTrunc (Ns_Set *set, int size) |
| void | Ns_SetDelete (Ns_Set *set, int index) |
| void | Ns_SetPutValue (Ns_Set *set, int index, char *value) |
| void | Ns_SetDeleteKey (Ns_Set *set, char *key) |
| void | Ns_SetIDeleteKey (Ns_Set *set, char *key) |
| Ns_Set * | Ns_SetListFind (Ns_Set **sets, char *name) |
| Ns_Set ** | Ns_SetSplit (Ns_Set *set, char sep) |
| void | Ns_SetListFree (Ns_Set **sets) |
| void | Ns_SetMerge (Ns_Set *high, Ns_Set *low) |
| Ns_Set * | Ns_SetCopy (Ns_Set *old) |
| void | Ns_SetMove (Ns_Set *to, Ns_Set *from) |
| void | Ns_SetPrint (Ns_Set *set) |
| Ns_Set* Ns_SetCopy | ( | Ns_Set * | old | ) |
----------------------------------------------------------------------
Ns_SetCopy --
Make a duplicate of a set.
Results: A new set.
Side effects: Will copy tuples and alloc new memory for them, too.
----------------------------------------------------------------------
| Ns_Set* Ns_SetCreate | ( | char * | name | ) |
----------------------------------------------------------------------
Ns_SetCreate --
Initialize a new set.
Results: A pointer to a new set.
Side effects: Memory is allocated; free with Ns_SetFree.
----------------------------------------------------------------------
| void Ns_SetDelete | ( | Ns_Set * | set, | |
| int | index | |||
| ) |
----------------------------------------------------------------------
Ns_SetDelete --
Delete a tuple from a set.
Results: None.
Side effects: Will free tuple memory.
----------------------------------------------------------------------
| void Ns_SetDeleteKey | ( | Ns_Set * | set, | |
| char * | key | |||
| ) |
----------------------------------------------------------------------
Ns_SetDeleteKey --
Delete a tuple from the set (case sensitive).
Results: None.
Side effects: Will free tuple memory.
----------------------------------------------------------------------
| int Ns_SetFind | ( | Ns_Set * | set, | |
| char * | key | |||
| ) |
----------------------------------------------------------------------
Ns_SetFind --
Locate the index of a field in a set (case sensitive)
Results: A field index or -1 if not found.
Side effects: None.
----------------------------------------------------------------------
| int Ns_SetFindCmp | ( | Ns_Set * | set, | |
| char * | key, | |||
| int(*)(char *s1, char *s2) | cmp | |||
| ) |
----------------------------------------------------------------------
Ns_SetFindCmp --
Returns the index of a tuple matching key, using a comparison function callback.
Results: A tuple index or -1 if no matches.
Side effects: None.
----------------------------------------------------------------------
| void Ns_SetFree | ( | Ns_Set * | set | ) |
----------------------------------------------------------------------
Ns_SetFree --
Free a set and its associated data with ns_free.
Results: None.
Side effects: Will free both the Ns_Set structure AND its tuples.
----------------------------------------------------------------------
| char* Ns_SetGet | ( | Ns_Set * | set, | |
| char * | key | |||
| ) |
----------------------------------------------------------------------
Ns_SetGet --
Return the value associated with a key, case sensitive.
Results: A value or NULL if key not found.
Side effects: None.
----------------------------------------------------------------------
| char* Ns_SetGetCmp | ( | Ns_Set * | set, | |
| char * | key, | |||
| int(*)(char *s1, char *s2) | cmp | |||
| ) |
----------------------------------------------------------------------
Ns_SetGetCmp --
Returns the value of a tuple matching key, using a comparison function callback.
Results: A value or NULL if no matches.
Side effects: None.
----------------------------------------------------------------------
| void Ns_SetIDeleteKey | ( | Ns_Set * | set, | |
| char * | key | |||
| ) |
----------------------------------------------------------------------
Ns_SetIDeleteKey --
Delete a tuple from the set (case insensitive).
Results: None.
Side effects: Will free tuple memory.
----------------------------------------------------------------------
| int Ns_SetIFind | ( | Ns_Set * | set, | |
| char * | key | |||
| ) |
----------------------------------------------------------------------
Ns_SetIFind --
Locate the index of a field in a set (case insensitive)
Results: A field index or -1 if not found.
Side effects: None.
----------------------------------------------------------------------
| char* Ns_SetIGet | ( | Ns_Set * | set, | |
| char * | key | |||
| ) |
----------------------------------------------------------------------
Ns_SetIGet --
Return the value associated with a key, case insensitive.
Results: A value or NULL if key not found.
Side effects: None.
----------------------------------------------------------------------
| int Ns_SetIUnique | ( | Ns_Set * | set, | |
| char * | key | |||
| ) |
----------------------------------------------------------------------
Ns_SetIUnique --
Check if a key in a set is unique (case insensitive).
Results: NS_TRUE if unique, NS_FALSE if not.
Side effects: None.
----------------------------------------------------------------------
| Ns_Set* Ns_SetListFind | ( | Ns_Set ** | sets, | |
| char * | name | |||
| ) |
----------------------------------------------------------------------
Ns_SetListFind --
In a null-terminated array of sets, find the set with the given name.
Results: A set, or NULL.
Side effects: None.
----------------------------------------------------------------------
| void Ns_SetListFree | ( | Ns_Set ** | sets | ) |
----------------------------------------------------------------------
Ns_SetListFree --
Free a null-terminated array of sets.
Results: None.
Side effects: Will free all sets in the array and their tuples.
----------------------------------------------------------------------
| void Ns_SetMerge | ( | Ns_Set * | high, | |
| Ns_Set * | low | |||
| ) |
----------------------------------------------------------------------
Ns_SetMerge --
Combine the 'low' set into the 'high' set.
Results: None.
Side effects: Will add tuples to 'high'.
----------------------------------------------------------------------
| void Ns_SetMove | ( | Ns_Set * | to, | |
| Ns_Set * | from | |||
| ) |
----------------------------------------------------------------------
Ns_SetMove --
Moves the data from one set to another, truncating the "from" set.
Results: None.
Side effects: None.
----------------------------------------------------------------------
| void Ns_SetPrint | ( | Ns_Set * | set | ) |
----------------------------------------------------------------------
Ns_SetPrint --
Dump the contents of a set to stderr.
Results: None.
Side effects: Will write to stderr.
----------------------------------------------------------------------
| int Ns_SetPut | ( | Ns_Set * | set, | |
| char * | key, | |||
| char * | value | |||
| ) |
----------------------------------------------------------------------
Ns_SetPut --
Insert a tuple into an existing set.
Results: The index number of the new tuple.
Side effects: The key/value will be strdup'ed.
----------------------------------------------------------------------
| void Ns_SetPutValue | ( | Ns_Set * | set, | |
| int | index, | |||
| char * | value | |||
| ) |
----------------------------------------------------------------------
Ns_SetPutValue --
Set the value for a given tuple.
Results: None.
Side effects: Will free the old value dup the new value.
----------------------------------------------------------------------
| Ns_Set** Ns_SetSplit | ( | Ns_Set * | set, | |
| char | sep | |||
| ) |
----------------------------------------------------------------------
Ns_SetSplit --
Split a set into an array of new sets. This assumes that each key name in the fields of a set contains a separating character. The fields of the set are partitioned into new sets whose set names are the characters before the separator and whose field key names are the characters after the separator.
Results: A new set.
Side effects: Will allocate a new set and tuples.
----------------------------------------------------------------------
| void Ns_SetTrunc | ( | Ns_Set * | set, | |
| int | size | |||
| ) |
----------------------------------------------------------------------
Ns_SetTrunc --
Remove all tuples after 'size'
Results: None.
Side effects: Will free tuple memory.
----------------------------------------------------------------------
| int Ns_SetUnique | ( | Ns_Set * | set, | |
| char * | key | |||
| ) |
----------------------------------------------------------------------
Ns_SetUnique --
Check if a key in a set is unique (case sensitive).
Results: NS_TRUE if unique, NS_FALSE if not.
Side effects: None.
----------------------------------------------------------------------
| int Ns_SetUniqueCmp | ( | Ns_Set * | set, | |
| char * | key, | |||
| int(*)(char *s1, char *s2) | cmp | |||
| ) |
----------------------------------------------------------------------
Ns_SetUniqueCmp --
Using the comparison function, see if multiple keys match key.
Results: NS_FALSE: multiple keys match key NS_TRUE: 0 or 1 keys match key.
Side effects: None.
----------------------------------------------------------------------
| void Ns_SetUpdate | ( | Ns_Set * | set, | |
| char * | key, | |||
| char * | value | |||
| ) |
----------------------------------------------------------------------
Ns_SetUpdate --
Remove a tuple and re-add it.
Results: None.
Side effects: None.
----------------------------------------------------------------------
1.5.1