Skip to content

Commit

Permalink
zend_ini: Implement zend_ini_string*() in terms of zend_ini_str*() (
Browse files Browse the repository at this point in the history
  • Loading branch information
TimWolla authored Jan 20, 2025
1 parent ce53dab commit 0f8340d
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions Zend/zend_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,40 +480,17 @@ ZEND_API double zend_ini_double(const char *name, size_t name_length, int orig)

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

ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
if (exists) {
*exists = 1;
}

if (orig && ini_entry->modified) {
return ini_entry->orig_value ? ZSTR_VAL(ini_entry->orig_value) : NULL;
} else {
return ini_entry->value ? ZSTR_VAL(ini_entry->value) : NULL;
}
} else {
if (exists) {
*exists = 0;
}
return NULL;
}
return str ? ZSTR_VAL(str) : NULL;
}
/* }}} */

ZEND_API char *zend_ini_string(const char *name, size_t name_length, int orig) /* {{{ */
{
bool exists = 1;
char *return_value;
zend_string *str = zend_ini_str(name, name_length, orig);

return_value = zend_ini_string_ex(name, name_length, orig, &exists);
if (!exists) {
return NULL;
} else if (!return_value) {
return_value = "";
}
return return_value;
return str ? ZSTR_VAL(str) : NULL;
}
/* }}} */

Expand Down

0 comments on commit 0f8340d

Please sign in to comment.