43 return "1.0, $Id: c5467396d4bfe62513fab439a836d384a4652b26 $";
116 if (group_name[0] ==
'[' && (
name =
strchr(group_name,
']')) !=
NULL) {
130 if (
key->group && *
key->group) {
134 }
else if (
key->name) {
143static char *etrim(
const char *str)
156 while (l && (
strchr(
" \t\r\n",
val[l-1]))) {
171 if (fline[0] ==
'[') {
259 while(inifile_read(dba, &ln)) {
260 if (!(
res=inifile_key_cmp(&ln.
key,
key))) {
270 }
else if (
res == 1) {
298 inifile_read(dba, &ln);
306static int inifile_truncate(
inifile *dba,
size_t size)
322static int inifile_find_group(
inifile *dba,
const key_type *
key,
size_t *pos_grp_start)
336 while(inifile_read(dba, &ln)) {
337 if ((
res=inifile_key_cmp(&ln.
key,
key)) < 2) {
359static int inifile_next_group(
inifile *dba,
const key_type *
key,
size_t *pos_grp_start)
366 while(inifile_read(dba, &ln)) {
367 if (inifile_key_cmp(&ln.
key,
key) == 2) {
379static int inifile_copy_to(
inifile *dba,
size_t pos_start,
size_t pos_end,
inifile **ini_copy)
383 if (pos_start == pos_end) {
411 size_t pos_start = 0, pos_next = 0, pos_curr;
417 while(inifile_read(from, &ln)) {
418 switch(inifile_key_cmp(&ln.
key,
key)) {
424 if (pos_start != pos_next) {
432 pos_next = pos_start = pos_curr;
443 if (pos_start != pos_next) {
458 size_t pos_grp_start=0, pos_grp_next;
477 inifile_find_group(dba,
key, &pos_grp_start);
478 inifile_next_group(dba,
key, &pos_grp_next);
482 ret = inifile_copy_to(dba, pos_grp_start, pos_grp_next, &ini_tmp);
506 ret = inifile_truncate(dba, append ? pos_grp_next : pos_grp_start);
513 if (!append && ini_tmp) {
514 ret = inifile_filter(dba, ini_tmp,
key, found);
522 if (pos_grp_start == pos_grp_next &&
key->group &&
strlen(
key->group)) {
560 return inifile_delete_replace_append(dba,
key,
NULL, 0,
NULL);
567 return inifile_delete_replace_append(dba,
key,
NULL, 0, found);
574 return inifile_delete_replace_append(dba,
key,
value, 0,
NULL);
581 return inifile_delete_replace_append(dba,
key,
value, 0, found);
588 return inifile_delete_replace_append(dba,
key,
value, 1,
NULL);
assert(mixed $assertion, Throwable|string|null $description=null)
strchr(string $haystack, string $needle, bool $before_needle=false)
memset(ptr, 0, type->size)
int inifile_replace_ex(inifile *dba, const key_type *key, const val_type *value, bool *found)
int inifile_append(inifile *dba, const key_type *key, const val_type *value)
void inifile_free(inifile *dba, int persistent)
int inifile_firstkey(inifile *dba)
inifile * inifile_alloc(php_stream *fp, int readonly, int persistent)
int inifile_delete(inifile *dba, const key_type *key)
int inifile_delete_ex(inifile *dba, const key_type *key, bool *found)
val_type inifile_fetch(inifile *dba, const key_type *key, int skip)
char * inifile_key_string(const key_type *key)
const char * inifile_version(void)
int inifile_nextkey(inifile *dba)
int inifile_replace(inifile *dba, const key_type *key, const val_type *value)
void inifile_key_free(key_type *key)
void inifile_val_free(val_type *val)
key_type inifile_key_split(const char *group_name)
void inifile_line_free(line_type *ln)
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
unsigned const char * pos
#define php_stream_temp_create(mode, max_memory_usage)
unsigned char key[REFLECTION_KEY_LEN]
#define php_stream_truncate_supported(stream)
struct _php_stream php_stream
#define php_stream_gets(stream, buf, maxlen)
#define php_stream_rewind(stream)
#define PHP_STREAM_COPY_ALL
#define php_stream_seek(stream, offset, whence)
#define php_stream_flush(stream)
#define php_stream_truncate_set_size(stream, size)
#define php_stream_printf
#define php_stream_close(stream)
#define php_stream_tell(stream)
#define php_stream_copy_to_stream_ex(src, dest, maxlen, len)
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
#define estrndup(s, length)
#define pefree(ptr, persistent)
#define pemalloc(size, persistent)
#define strcasecmp(s1, s2)