25 struct Key_Value *kv = G_malloc(
sizeof(
struct Key_Value));
27 G_zero(kv,
sizeof(
struct Key_Value));
46 for (n = 0; n < kv->nitems; n++)
47 if (strcmp(key, kv->key[n]) == 0)
50 if (n == kv->nitems) {
51 if (n >= kv->nalloc) {
59 size = kv->nalloc *
sizeof(
char *);
60 kv->key = G_realloc(kv->key, size);
61 kv->value = G_realloc(kv->value, size);
92 for (n = 0; n < kv->nitems; n++)
93 if (strcmp(key, kv->key[n]) == 0)
94 return kv->value[n][0] ? kv->value[n] :
NULL;
111 for (n = 0; n < kv->nitems; n++) {
void G_free(void *buf)
Free allocated memory.
void G_free_key_value(struct Key_Value *kv)
Free allocated Key_Value structure.
void G_set_key_value(const char *key, const char *value, struct Key_Value *kv)
Set value for given key.
const char * G_find_key_value(const char *key, const struct Key_Value *kv)
Find given key (case sensitive)
struct Key_Value * G_create_key_value(void)
Allocate and initialize Key_Value structure.
char * G_store(const char *s)
Copy string to allocated memory.
void G_zero(void *buf, int i)
Zero out a buffer, buf, of length i.