Skip to content

Commit a850666

Browse files
committed
zend_is_whitespace as a function
1 parent 5ae084c commit a850666

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Zend/zend_ini.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ static HashTable *registered_zend_ini_directives;
3030
#define NO_VALUE_PLAINTEXT "no value"
3131
#define NO_VALUE_HTML "<i>no value</i>"
3232

33-
#define ZEND_IS_WHITESPACE(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r') || ((c) == '\v') || ((c) == '\f'))
33+
static inline bool zend_is_whitespace(char c) {
34+
return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\v' || c == '\f';
35+
}
3436

3537
/*
3638
* hash_apply functions
@@ -545,7 +547,8 @@ ZEND_API zend_long zend_ini_parse_quantity(zend_string *value, zend_string **err
545547
size_t str_len = ZSTR_LEN(value);
546548

547549
/* Ignore trailing whitespace */
548-
while (str_len && ZEND_IS_WHITESPACE(str[str_len-1])) --str_len;
550+
while (str_len && zend_is_whitespace(str[str_len-1])) --str_len;
551+
549552
if (!str_len) {
550553
*errstr = NULL;
551554
return 0;
@@ -565,7 +568,7 @@ ZEND_API zend_long zend_ini_parse_quantity(zend_string *value, zend_string **err
565568
}
566569

567570
/* Allow for whitespace between integer portion and any suffix character */
568-
while (ZEND_IS_WHITESPACE(*digits_end)) ++digits_end;
571+
while (zend_is_whitespace(*digits_end)) ++digits_end;
569572

570573
/* No exponent suffix. */
571574
if (!*digits_end) {

0 commit comments

Comments
 (0)