Skip to content

Commit 0f8340d

Browse files
authored
zend_ini: Implement zend_ini_string*() in terms of zend_ini_str*() (#17530)
1 parent ce53dab commit 0f8340d

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

Zend/zend_ini.c

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -480,40 +480,17 @@ ZEND_API double zend_ini_double(const char *name, size_t name_length, int orig)
480480

481481
ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, int orig, bool *exists) /* {{{ */
482482
{
483-
zend_ini_entry *ini_entry;
483+
zend_string *str = zend_ini_str_ex(name, name_length, orig, exists);
484484

485-
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
486-
if (ini_entry) {
487-
if (exists) {
488-
*exists = 1;
489-
}
490-
491-
if (orig && ini_entry->modified) {
492-
return ini_entry->orig_value ? ZSTR_VAL(ini_entry->orig_value) : NULL;
493-
} else {
494-
return ini_entry->value ? ZSTR_VAL(ini_entry->value) : NULL;
495-
}
496-
} else {
497-
if (exists) {
498-
*exists = 0;
499-
}
500-
return NULL;
501-
}
485+
return str ? ZSTR_VAL(str) : NULL;
502486
}
503487
/* }}} */
504488

505489
ZEND_API char *zend_ini_string(const char *name, size_t name_length, int orig) /* {{{ */
506490
{
507-
bool exists = 1;
508-
char *return_value;
491+
zend_string *str = zend_ini_str(name, name_length, orig);
509492

510-
return_value = zend_ini_string_ex(name, name_length, orig, &exists);
511-
if (!exists) {
512-
return NULL;
513-
} else if (!return_value) {
514-
return_value = "";
515-
}
516-
return return_value;
493+
return str ? ZSTR_VAL(str) : NULL;
517494
}
518495
/* }}} */
519496

0 commit comments

Comments
 (0)