Skip to content

Commit 3aee5cb

Browse files
Various return types and values consolidation
1 parent e4078a6 commit 3aee5cb

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

Zend/zend_API.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3770,7 +3770,7 @@ static zend_always_inline zend_class_entry *get_scope(zend_execute_data *frame)
37703770

37713771
static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *scope, zend_execute_data *frame, zend_fcall_info_cache *fcc, bool *strict_class, char **error, bool suppress_deprecation) /* {{{ */
37723772
{
3773-
bool ret = 0;
3773+
bool ret = false;
37743774
zend_class_entry *ce;
37753775
size_t name_len = ZSTR_LEN(name);
37763776
zend_string *lcname;
@@ -3795,7 +3795,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc
37953795
if (!fcc->object) {
37963796
fcc->object = zend_get_this_object(frame);
37973797
}
3798-
ret = 1;
3798+
ret = true;
37993799
}
38003800
} else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_PARENT))) {
38013801
if (!scope) {
@@ -3815,7 +3815,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc
38153815
fcc->object = zend_get_this_object(frame);
38163816
}
38173817
*strict_class = 1;
3818-
ret = 1;
3818+
ret = true;
38193819
}
38203820
} else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_STATIC))) {
38213821
zend_class_entry *called_scope = zend_get_called_scope(frame);
@@ -3832,7 +3832,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc
38323832
fcc->object = zend_get_this_object(frame);
38333833
}
38343834
*strict_class = 1;
3835-
ret = 1;
3835+
ret = true;
38363836
}
38373837
} else if ((ce = zend_lookup_class(name)) != NULL) {
38383838
zend_class_entry *scope = get_scope(frame);
@@ -3852,7 +3852,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc
38523852
fcc->called_scope = fcc->object ? fcc->object->ce : ce;
38533853
}
38543854
*strict_class = 1;
3855-
ret = 1;
3855+
ret = true;
38563856
} else {
38573857
if (error) zend_spprintf(error, 0, "class \"%.*s\" not found", (int)name_len, ZSTR_VAL(name));
38583858
}

ext/standard/image.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,20 +1198,20 @@ static struct php_gfxinfo *php_handle_avif(php_stream * stream) {
11981198
}
11991199
/* }}} */
12001200

1201-
/* {{{ php_is_image_avif
1201+
/*
12021202
* Detect whether an image is of type AVIF
12031203
*
12041204
* Only the first "ftyp" box is read.
12051205
* For a valid file, 12 bytes are usually read, but more might be necessary.
12061206
*/
1207-
bool php_is_image_avif(php_stream* stream) {
1207+
bool php_is_image_avif(php_stream* stream) { /* {{{ php_is_image_avif */
12081208
struct php_avif_stream avif_stream;
12091209
avif_stream.stream = stream;
12101210

12111211
if (AvifInfoIdentifyStream(&avif_stream, php_avif_stream_read, php_avif_stream_skip) == kAvifInfoOk) {
1212-
return 1;
1212+
return true;
12131213
}
1214-
return 0;
1214+
return false;
12151215
}
12161216
/* }}} */
12171217

main/php_variables.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,15 @@ static bool add_post_var(zval *arr, post_var_data_t *var, bool eof)
346346
size_t new_vlen;
347347

348348
if (var->ptr >= var->end) {
349-
return 0;
349+
return false;
350350
}
351351

352352
start = var->ptr + var->already_scanned;
353353
vsep = memchr(start, '&', var->end - start);
354354
if (!vsep) {
355355
if (!eof) {
356356
var->already_scanned = var->end - var->ptr;
357-
return 0;
357+
return false;
358358
} else {
359359
vsep = var->end;
360360
}
@@ -387,10 +387,10 @@ static bool add_post_var(zval *arr, post_var_data_t *var, bool eof)
387387

388388
var->ptr = vsep + (vsep != var->end);
389389
var->already_scanned = 0;
390-
return 1;
390+
return true;
391391
}
392392

393-
static inline int add_post_vars(zval *arr, post_var_data_t *vars, bool eof)
393+
static inline zend_result add_post_vars(zval *arr, post_var_data_t *vars, bool eof)
394394
{
395395
uint64_t max_vars = REQUEST_PARSE_BODY_OPTION_GET(max_input_vars, PG(max_input_vars));
396396

@@ -782,7 +782,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src)
782782
/* }}} */
783783

784784
/* {{{ php_hash_environment */
785-
PHPAPI int php_hash_environment(void)
785+
PHPAPI zend_result php_hash_environment(void)
786786
{
787787
memset(PG(http_globals), 0, sizeof(PG(http_globals)));
788788
zend_activate_auto_globals();
@@ -805,7 +805,7 @@ static bool php_auto_globals_create_get(zend_string *name)
805805
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_GET]);
806806
Z_ADDREF(PG(http_globals)[TRACK_VARS_GET]);
807807

808-
return 0; /* don't rearm */
808+
return false; /* don't rearm */
809809
}
810810

811811
static bool php_auto_globals_create_post(zend_string *name)
@@ -824,7 +824,7 @@ static bool php_auto_globals_create_post(zend_string *name)
824824
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_POST]);
825825
Z_ADDREF(PG(http_globals)[TRACK_VARS_POST]);
826826

827-
return 0; /* don't rearm */
827+
return false; /* don't rearm */
828828
}
829829

830830
static bool php_auto_globals_create_cookie(zend_string *name)
@@ -839,7 +839,7 @@ static bool php_auto_globals_create_cookie(zend_string *name)
839839
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_COOKIE]);
840840
Z_ADDREF(PG(http_globals)[TRACK_VARS_COOKIE]);
841841

842-
return 0; /* don't rearm */
842+
return false; /* don't rearm */
843843
}
844844

845845
static bool php_auto_globals_create_files(zend_string *name)
@@ -851,7 +851,7 @@ static bool php_auto_globals_create_files(zend_string *name)
851851
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_FILES]);
852852
Z_ADDREF(PG(http_globals)[TRACK_VARS_FILES]);
853853

854-
return 0; /* don't rearm */
854+
return false; /* don't rearm */
855855
}
856856

857857
/* Ugly hack to fix HTTP_PROXY issue, see bug #72573 */
@@ -905,7 +905,7 @@ static bool php_auto_globals_create_server(zend_string *name)
905905
* ignore this issue, as it would probably require larger changes. */
906906
HT_ALLOW_COW_VIOLATION(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]));
907907

908-
return 0; /* don't rearm */
908+
return false; /* don't rearm */
909909
}
910910

911911
static bool php_auto_globals_create_env(zend_string *name)
@@ -921,7 +921,7 @@ static bool php_auto_globals_create_env(zend_string *name)
921921
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_ENV]);
922922
Z_ADDREF(PG(http_globals)[TRACK_VARS_ENV]);
923923

924-
return 0; /* don't rearm */
924+
return false; /* don't rearm */
925925
}
926926

927927
static bool php_auto_globals_create_request(zend_string *name)
@@ -965,7 +965,7 @@ static bool php_auto_globals_create_request(zend_string *name)
965965
}
966966

967967
zend_hash_update(&EG(symbol_table), name, &form_variables);
968-
return 0;
968+
return false;
969969
}
970970

971971
void php_startup_auto_globals(void)

main/php_variables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PHPAPI void php_register_variable_ex(const char *var, zval *val, zval *track_var
3939
PHPAPI void php_register_known_variable(const char *var, size_t var_len, zval *value, zval *track_vars_array);
4040

4141
PHPAPI void php_build_argv(const char *s, zval *track_vars_array);
42-
PHPAPI int php_hash_environment(void);
42+
PHPAPI zend_result php_hash_environment(void);
4343
END_EXTERN_C()
4444

4545
#define NUM_TRACK_VARS 6

sapi/phpdbg/phpdbg_watch.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *newPtr)
139139
switch (type) {
140140
case WATCH_ON_BUCKET:
141141
if (memcmp(&((Bucket *) oldPtr)->h, &((Bucket *) newPtr)->h, sizeof(Bucket) - sizeof(zval) /* hash+key comparison */) != 0) {
142-
return 2;
142+
return true;
143143
}
144144
/* Fall through to also compare the value from the bucket. */
145145
ZEND_FALLTHROUGH;
@@ -154,7 +154,7 @@ bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *newPtr)
154154
case WATCH_ON_HASHDATA:
155155
ZEND_UNREACHABLE();
156156
}
157-
return 0;
157+
return false;
158158
}
159159

160160
void phpdbg_print_watch_diff(phpdbg_watchtype type, zend_string *name, void *oldPtr, void *newPtr) {
@@ -280,9 +280,9 @@ static inline void phpdbg_deactivate_watchpoint(phpdbg_watchpoint_t *watch) {
280280

281281
/* Note that consecutive pages need to be merged in order to avoid watchpoints spanning page boundaries to have part of their data in the one page, part in the other page */
282282
#ifdef _WIN32
283-
int phpdbg_watchpoint_segfault_handler(void *addr) {
283+
zend_result phpdbg_watchpoint_segfault_handler(void *addr) {
284284
#else
285-
int phpdbg_watchpoint_segfault_handler(siginfo_t *info, void *context) {
285+
zend_result phpdbg_watchpoint_segfault_handler(siginfo_t *info, void *context) {
286286
#endif
287287

288288
void *page = phpdbg_get_page_boundary(
@@ -562,12 +562,12 @@ bool phpdbg_is_recursively_watched(void *ptr, phpdbg_watch_element *element) {
562562
do {
563563
element = next;
564564
if (element->watch->addr.ptr == ptr) {
565-
return 1;
565+
return true;
566566
}
567567
next = element->parent;
568568
} while (!(element->flags & PHPDBG_WATCH_RECURSIVE_ROOT));
569569

570-
return 0;
570+
return false;
571571
}
572572

573573
void phpdbg_add_recursive_watch_from_ht(phpdbg_watch_element *element, zend_long idx, zend_string *str, zval *zv) {
@@ -721,7 +721,7 @@ bool phpdbg_try_re_adding_watch_element(zval *parent, phpdbg_watch_element *elem
721721
HashTable *ht = HT_FROM_ZVP(parent);
722722

723723
if (!ht) {
724-
return 0;
724+
return false;
725725
} else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) {
726726
char *htPtr = ((char *) ht) + HT_WATCH_OFFSET;
727727
char *oldPtr = ((char *) &element->backup.ht) + HT_WATCH_OFFSET;
@@ -742,7 +742,7 @@ bool phpdbg_try_re_adding_watch_element(zval *parent, phpdbg_watch_element *elem
742742
}
743743

744744
if (!phpdbg_try_re_adding_watch_element(next, element->child)) {
745-
return 0;
745+
return false;
746746
}
747747
} else if (phpdbg_check_watch_diff(WATCH_ON_ZVAL, &element->backup.zv, zv)) {
748748
phpdbg_print_watch_diff(WATCH_ON_ZVAL, element->str, &element->backup.zv, zv);
@@ -752,10 +752,10 @@ bool phpdbg_try_re_adding_watch_element(zval *parent, phpdbg_watch_element *elem
752752
phpdbg_add_bucket_watch_element((Bucket *) zv, element);
753753
phpdbg_watch_parent_ht(element);
754754
} else {
755-
return 0;
755+
return false;
756756
}
757757

758-
return 1;
758+
return true;
759759
}
760760

761761
void phpdbg_automatic_dequeue_free(phpdbg_watch_element *element) {

0 commit comments

Comments
 (0)