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 TSRMLS_DC) { 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()
263 if (!(res=inifile_key_cmp(&ln.key, key TSRMLS_CC))) { in inifile_fetch()
302 ln.key.group = estrdup(dba->curr.key.group ? dba->curr.key.group : ""); in inifile_nextkey()
306 return ln.key.group || ln.key.name; in inifile_nextkey()
328 static int inifile_find_group(inifile *dba, const key_type *key, size_t *pos_grp_start TSRMLS_DC) in inifile_find_group() argument
337 if (key->group && strlen(key->group)) { in inifile_find_group()
343 if ((res=inifile_key_cmp(&ln.key, key TSRMLS_CC)) < 2) { in inifile_find_group()
365 static int inifile_next_group(inifile *dba, const key_type *key, size_t *pos_grp_start TSRMLS_DC) in inifile_next_group() argument
371 ln.key.group = estrdup(key->group); in inifile_next_group()
373 if (inifile_key_cmp(&ln.key, key TSRMLS_CC) == 2) { in inifile_next_group()
416 static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRMLS_DC) in inifile_filter()
425 switch(inifile_key_cmp(&ln.key, key TSRMLS_CC)) { in inifile_filter()
461 static int inifile_delete_replace_append(inifile *dba, const key_type *key, const val_type *value, … in inifile_delete_replace_append() argument
479 assert(!append || (key->name && value)); /* missuse */ in inifile_delete_replace_append()
482 inifile_find_group(dba, key, &pos_grp_start TSRMLS_CC); in inifile_delete_replace_append()
483 inifile_next_group(dba, key, &pos_grp_next TSRMLS_CC); in inifile_delete_replace_append()
510 if (!value || (key->name && strlen(key->name))) { in inifile_delete_replace_append()
516 if (key->name && strlen(key->name)) { in inifile_delete_replace_append()
519 ret = inifile_filter(dba, ini_tmp, key TSRMLS_CC); in inifile_delete_replace_append()
527 if (pos_grp_start == pos_grp_next && key->group && strlen(key->group)) { in inifile_delete_replace_append()
528 php_stream_printf(dba->fp TSRMLS_CC, "[%s]\n", key->group); in inifile_delete_replace_append()
530 php_stream_printf(dba->fp TSRMLS_CC, "%s=%s\n", key->name, value->value ? value->value : ""); in inifile_delete_replace_append()
564 int inifile_delete(inifile *dba, const key_type *key TSRMLS_DC) in inifile_delete()
566 return inifile_delete_replace_append(dba, key, NULL, 0 TSRMLS_CC); in inifile_delete()
572 int inifile_replace(inifile *dba, const key_type *key, const val_type *value TSRMLS_DC) in inifile_replace() argument
574 return inifile_delete_replace_append(dba, key, value, 0 TSRMLS_CC); in inifile_replace()
580 int inifile_append(inifile *dba, const key_type *key, const val_type *value TSRMLS_DC) in inifile_append() argument
582 return inifile_delete_replace_append(dba, key, value, 1 TSRMLS_CC); in inifile_append()