Lines Matching refs:key

48 void inifile_key_free(key_type *key)  in inifile_key_free()  argument
50 if (key->group) { in inifile_key_free()
51 efree(key->group); in inifile_key_free()
53 if (key->name) { in inifile_key_free()
54 efree(key->name); in inifile_key_free()
56 memset(key, 0, sizeof(key_type)); in inifile_key_free()
73 inifile_key_free(&ln->key); in inifile_line_free()
113 key_type key; in inifile_key_split() local
117 key.group = estrndup(group_name+1, name - (group_name + 1)); in inifile_key_split()
118 key.name = estrdup(name+1); in inifile_key_split()
120 key.group = estrdup(""); in inifile_key_split()
121 key.name = estrdup(group_name); in inifile_key_split()
123 return key; in inifile_key_split()
128 char * inifile_key_string(const key_type *key) in inifile_key_string() argument
130 if (key->group && *key->group) { in inifile_key_string()
132 spprintf(&result, 0, "[%s]%s", key->group, key->name ? key->name : ""); in inifile_key_string()
134 } else if (key->name) { in inifile_key_string()
135 return estrdup(key->name); in inifile_key_string()
178 inifile_key_free(&ln->key); in inifile_read()
179 ln->key.group = etrim(fline+1); in inifile_read()
180 ln->key.name = estrdup(""); in inifile_read()
193 if (!ln->key.group) { in inifile_read()
194 ln->key.group = estrdup(""); in inifile_read()
196 if (ln->key.name) { in inifile_read()
197 efree(ln->key.name); in inifile_read()
199 ln->key.name = etrim(fline); in inifile_read()
241 val_type inifile_fetch(inifile *dba, const key_type *key, int skip) { in inifile_fetch() argument
246 …if (skip == -1 && dba->next.key.group && dba->next.key.name && !inifile_key_cmp(&dba->next.key, ke… in inifile_fetch()
249 ln.key.group = estrdup(dba->next.key.group); in inifile_fetch()
260 if (!(res=inifile_key_cmp(&ln.key, key))) { in inifile_fetch()
297 ln.key.group = estrdup(dba->curr.key.group ? dba->curr.key.group : ""); in inifile_nextkey()
301 return ln.key.group || ln.key.name; in inifile_nextkey()
322 static int inifile_find_group(inifile *dba, const key_type *key, size_t *pos_grp_start) in inifile_find_group() argument
331 if (key->group && strlen(key->group)) { in inifile_find_group()
337 if ((res=inifile_key_cmp(&ln.key, key)) < 2) { in inifile_find_group()
359 static int inifile_next_group(inifile *dba, const key_type *key, size_t *pos_grp_start) in inifile_next_group() argument
365 ln.key.group = estrdup(key->group); in inifile_next_group()
367 if (inifile_key_cmp(&ln.key, key) == 2) { in inifile_next_group()
409 static int inifile_filter(inifile *dba, inifile *from, const key_type *key, bool *found) in inifile_filter() argument
418 switch(inifile_key_cmp(&ln.key, key)) { in inifile_filter()
456 static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, … in inifile_delete_replace_append() argument
474 assert(!append || (key->name && value)); /* missuse */ in inifile_delete_replace_append()
477 inifile_find_group(dba, key, &pos_grp_start); in inifile_delete_replace_append()
478 inifile_next_group(dba, key, &pos_grp_next); in inifile_delete_replace_append()
505 if (!value || (key->name && strlen(key->name))) { in inifile_delete_replace_append()
511 if (key->name && strlen(key->name)) { in inifile_delete_replace_append()
514 ret = inifile_filter(dba, ini_tmp, key, found); in inifile_delete_replace_append()
522 if (pos_grp_start == pos_grp_next && key->group && strlen(key->group)) { in inifile_delete_replace_append()
523 php_stream_printf(dba->fp, "[%s]\n", key->group); in inifile_delete_replace_append()
525 php_stream_printf(dba->fp, "%s=%s\n", key->name, value->value ? value->value : ""); in inifile_delete_replace_append()
558 int inifile_delete(inifile *dba, const key_type *key) in inifile_delete() argument
560 return inifile_delete_replace_append(dba, key, NULL, 0, NULL); in inifile_delete()
565 int inifile_delete_ex(inifile *dba, const key_type *key, bool *found) in inifile_delete_ex() argument
567 return inifile_delete_replace_append(dba, key, NULL, 0, found); in inifile_delete_ex()
572 int inifile_replace(inifile *dba, const key_type *key, const val_type *value) in inifile_replace() argument
574 return inifile_delete_replace_append(dba, key, value, 0, NULL); in inifile_replace()
579 int inifile_replace_ex(inifile *dba, const key_type *key, const val_type *value, bool *found) in inifile_replace_ex() argument
581 return inifile_delete_replace_append(dba, key, value, 0, found); in inifile_replace_ex()
586 int inifile_append(inifile *dba, const key_type *key, const val_type *value) in inifile_append() argument
588 return inifile_delete_replace_append(dba, key, value, 1, NULL); in inifile_append()