Lines Matching refs:key
50 void inifile_key_free(key_type *key) in inifile_key_free() argument
52 if (key->group) { in inifile_key_free()
53 efree(key->group); in inifile_key_free()
55 if (key->name) { in inifile_key_free()
56 efree(key->name); in inifile_key_free()
58 memset(key, 0, sizeof(key_type)); in inifile_key_free()
75 inifile_key_free(&ln->key); in inifile_line_free()
115 key_type key; in inifile_key_split() local
119 key.group = estrndup(group_name+1, name - (group_name + 1)); in inifile_key_split()
120 key.name = estrdup(name+1); in inifile_key_split()
122 key.group = estrdup(""); in inifile_key_split()
123 key.name = estrdup(group_name); in inifile_key_split()
125 return key; in inifile_key_split()
130 char * inifile_key_string(const key_type *key) in inifile_key_string() argument
132 if (key->group && *key->group) { in inifile_key_string()
134 spprintf(&result, 0, "[%s]%s", key->group, key->name ? key->name : ""); in inifile_key_string()
136 } else if (key->name) { in inifile_key_string()
137 return estrdup(key->name); in inifile_key_string()
181 inifile_key_free(&ln->key); in inifile_read()
182 ln->key.group = etrim(fline+1); in inifile_read()
183 ln->key.name = estrdup(""); in inifile_read()
196 if (!ln->key.group) { in inifile_read()
197 ln->key.group = estrdup(""); in inifile_read()
199 if (ln->key.name) { in inifile_read()
200 efree(ln->key.name); in inifile_read()
202 ln->key.name = etrim(fline); in inifile_read()
245 val_type inifile_fetch(inifile *dba, const key_type *key, int skip) { in inifile_fetch() argument
250 …if (skip == -1 && dba->next.key.group && dba->next.key.name && !inifile_key_cmp(&dba->next.key, ke… in inifile_fetch()
253 ln.key.group = estrdup(dba->next.key.group); in inifile_fetch()
264 if (!(res=inifile_key_cmp(&ln.key, key))) { in inifile_fetch()
303 ln.key.group = estrdup(dba->curr.key.group ? dba->curr.key.group : ""); in inifile_nextkey()
307 return ln.key.group || ln.key.name; in inifile_nextkey()
329 static int inifile_find_group(inifile *dba, const key_type *key, size_t *pos_grp_start) in inifile_find_group() argument
338 if (key->group && strlen(key->group)) { in inifile_find_group()
344 if ((res=inifile_key_cmp(&ln.key, key)) < 2) { in inifile_find_group()
366 static int inifile_next_group(inifile *dba, const key_type *key, size_t *pos_grp_start) in inifile_next_group() argument
372 ln.key.group = estrdup(key->group); in inifile_next_group()
374 if (inifile_key_cmp(&ln.key, key) == 2) { in inifile_next_group()
417 static int inifile_filter(inifile *dba, inifile *from, const key_type *key, zend_bool *found) in inifile_filter() argument
426 switch(inifile_key_cmp(&ln.key, key)) { in inifile_filter()
465 static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, … in inifile_delete_replace_append() argument
483 assert(!append || (key->name && value)); /* missuse */ in inifile_delete_replace_append()
486 inifile_find_group(dba, key, &pos_grp_start); in inifile_delete_replace_append()
487 inifile_next_group(dba, key, &pos_grp_next); in inifile_delete_replace_append()
514 if (!value || (key->name && strlen(key->name))) { in inifile_delete_replace_append()
520 if (key->name && strlen(key->name)) { in inifile_delete_replace_append()
523 ret = inifile_filter(dba, ini_tmp, key, found); in inifile_delete_replace_append()
531 if (pos_grp_start == pos_grp_next && key->group && strlen(key->group)) { in inifile_delete_replace_append()
532 php_stream_printf(dba->fp, "[%s]\n", key->group); in inifile_delete_replace_append()
534 php_stream_printf(dba->fp, "%s=%s\n", key->name, value->value ? value->value : ""); in inifile_delete_replace_append()
568 int inifile_delete(inifile *dba, const key_type *key) in inifile_delete() argument
570 return inifile_delete_replace_append(dba, key, NULL, 0, NULL); in inifile_delete()
576 int inifile_delete_ex(inifile *dba, const key_type *key, zend_bool *found) in inifile_delete_ex() argument
578 return inifile_delete_replace_append(dba, key, NULL, 0, found); in inifile_delete_ex()
584 int inifile_replace(inifile *dba, const key_type *key, const val_type *value) in inifile_replace() argument
586 return inifile_delete_replace_append(dba, key, value, 0, NULL); in inifile_replace()
592 int inifile_replace_ex(inifile *dba, const key_type *key, const val_type *value, zend_bool *found) in inifile_replace_ex() argument
594 return inifile_delete_replace_append(dba, key, value, 0, found); in inifile_replace_ex()
600 int inifile_append(inifile *dba, const key_type *key, const val_type *value) in inifile_append() argument
602 return inifile_delete_replace_append(dba, key, value, 1, NULL); in inifile_append()