Lines Matching +full:key +full:- +full:value
1 #!perl -w
4 @parms = qw(NAME KEY VALUE COMPARE COPYKEY FREEKEY FREEVALUE);
16 * key: <KEY>
17 * value: <VALUE>
24 <KEY> key;
25 <VALUE> value;
34 head->first = NULL;
40 void (*free_key)(<KEY>) = <FREEKEY>;
41 void (*free_value)(<VALUE>) = <FREEVALUE>;
42 for (e = head->first; e; e = e_next) {
43 e_next = e->next;
45 (*free_key)(e->key);
47 (*free_value)(e->value);
50 head->first = NULL;
52 /* Returns pointer to linked-list entry, or null if key not found. */
54 <NAME>__find_node (struct <NAME>__head *head, <KEY> key)
57 for (e = head->first; e; e = e->next)
58 if (<COMPARE> (key, e->key) == 0)
62 /* Returns pointer to value, or null if key not found. */
63 static inline <VALUE> *
64 <NAME>_find (struct <NAME>__head *head, <KEY> key)
66 struct <NAME>__element *e = <NAME>__find_node(head, key);
68 return &e->value;
73 <NAME>__copy_key (<KEY> *out, <KEY> in)
75 int (*copykey)(<KEY> *, <KEY>) = <COPYKEY>;
85 <KEY> key, <VALUE> new_value)
87 struct <NAME>__element *e = <NAME>__find_node(head, key);
92 void (*free_value)(<VALUE>) = <FREEVALUE>;
94 (*free_value)(e->value);
95 e->value = new_value;
101 ret = <NAME>__copy_key (&e->key, key);
106 e->value = new_value;
107 e->next = head->first;
108 head->first = e;