Skip to content

Commit 3599c4b

Browse files
committed
Zend: convert debug handler to take a bool pointer
1 parent ff7fe63 commit 3599c4b

File tree

13 files changed

+44
-44
lines changed

13 files changed

+44
-44
lines changed

Zend/zend_closures.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,15 @@ static zend_result zend_closure_get_closure(zend_object *obj, zend_class_entry *
577577
/* }}} */
578578

579579
/* *is_temp is int due to Object Handler API */
580-
static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
580+
static HashTable *zend_closure_get_debug_info(zend_object *object, bool *is_temp) /* {{{ */
581581
{
582582
zend_closure *closure = (zend_closure *)object;
583583
zval val;
584584
struct _zend_arg_info *arg_info = closure->func.common.arg_info;
585585
HashTable *debug_info;
586586
bool zstr_args = (closure->func.type == ZEND_USER_FUNCTION) || (closure->func.common.fn_flags & ZEND_ACC_USER_ARG_INFO);
587587

588-
*is_temp = 1;
588+
*is_temp = true;
589589

590590
debug_info = zend_new_array(8);
591591

Zend/zend_object_handlers.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ ZEND_API HashTable *zend_std_get_gc(zend_object *zobj, zval **table, int *n) /*
152152
}
153153
/* }}} */
154154

155-
ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
155+
ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, bool *is_temp) /* {{{ */
156156
{
157157
zend_class_entry *ce = object->ce;
158158
zval retval;
@@ -166,19 +166,19 @@ ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) /
166166
zend_call_known_instance_method_with_0_params(ce->__debugInfo, object, &retval);
167167
if (Z_TYPE(retval) == IS_ARRAY) {
168168
if (!Z_REFCOUNTED(retval)) {
169-
*is_temp = 1;
169+
*is_temp = true;
170170
return zend_array_dup(Z_ARRVAL(retval));
171171
} else if (Z_REFCOUNT(retval) <= 1) {
172-
*is_temp = 1;
172+
*is_temp = true;
173173
ht = Z_ARR(retval);
174174
return ht;
175175
} else {
176-
*is_temp = 0;
176+
*is_temp = false;
177177
zval_ptr_dtor(&retval);
178178
return Z_ARRVAL(retval);
179179
}
180180
} else if (Z_TYPE(retval) == IS_NULL) {
181-
*is_temp = 0;
181+
*is_temp = false;
182182
zval_ptr_dtor(&retval);
183183
return (HashTable*)&zend_empty_array;
184184
} else {
@@ -1974,7 +1974,7 @@ ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purp
19741974
switch (purpose) {
19751975
case ZEND_PROP_PURPOSE_DEBUG:
19761976
if (obj->handlers->get_debug_info) {
1977-
int is_temp;
1977+
bool is_temp;
19781978
ht = obj->handlers->get_debug_info(obj, &is_temp);
19791979
if (ht && !is_temp) {
19801980
GC_TRY_ADDREF(ht);

Zend/zend_object_handlers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ typedef HashTable *(*zend_object_get_properties_t)(zend_object *object);
9191
/* Must only return NULL when an exception occurs, if no properties
9292
* return (HashTable*)&zend_empty_array;
9393
*/
94-
typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, int *is_temp);
94+
typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, bool *is_temp);
9595

9696
typedef enum _zend_prop_purpose {
9797
/* Used for debugging. Supersedes get_debug_info handler. */
@@ -218,7 +218,7 @@ ZEND_API zend_function *zend_std_get_constructor(zend_object *object);
218218
ZEND_API struct _zend_property_info *zend_get_property_info(const zend_class_entry *ce, zend_string *member, int silent);
219219
ZEND_API HashTable *zend_std_get_properties(zend_object *object);
220220
ZEND_API HashTable *zend_std_get_gc(zend_object *object, zval **table, int *n);
221-
ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp);
221+
ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, bool *is_temp);
222222
ZEND_API zend_result zend_std_cast_object_tostring(zend_object *object, zval *writeobj, int type);
223223
ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot);
224224
ZEND_API zval *zend_std_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);

Zend/zend_weakrefs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ static void zend_weakref_free(zend_object *zo) {
271271
zend_object_std_dtor(&wr->std);
272272
}
273273

274-
static HashTable *zend_weakref_get_debug_info(zend_object *object, int *is_temp)
274+
static HashTable *zend_weakref_get_debug_info(zend_object *object, bool *is_temp)
275275
{
276-
*is_temp = 1;
276+
*is_temp = true;
277277

278278
HashTable *ht = zend_new_array(1);
279279

ext/date/php_date.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static HashTable *date_object_get_properties_interval(zend_object *object);
354354
static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n);
355355
static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose);
356356
static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n);
357-
static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp);
357+
static HashTable *date_object_get_debug_info_timezone(zend_object *object, bool *is_temp);
358358
static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv);
359359

360360
static int date_interval_compare_objects(zval *o1, zval *o2);
@@ -2131,7 +2131,7 @@ static HashTable *date_object_get_properties_for_timezone(zend_object *object, z
21312131
return props;
21322132
} /* }}} */
21332133

2134-
static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp) /* {{{ */
2134+
static HashTable *date_object_get_debug_info_timezone(zend_object *object, bool *is_temp) /* {{{ */
21352135
{
21362136
HashTable *ht, *props;
21372137
zval zv;
@@ -2140,7 +2140,7 @@ static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *
21402140
tzobj = php_timezone_obj_from_obj(object);
21412141
props = zend_std_get_properties(object);
21422142

2143-
*is_temp = 1;
2143+
*is_temp = false;
21442144
ht = zend_array_dup(props);
21452145

21462146
ZVAL_LONG(&zv, tzobj->type);

ext/dom/php_dom.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ static int dom_property_exists(zend_object *object, zend_string *name, int check
436436
}
437437
/* }}} */
438438

439-
static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /* {{{ */
439+
static HashTable* dom_get_debug_info_helper(zend_object *object, bool *is_temp) /* {{{ */
440440
{
441441
dom_object *obj = php_dom_obj_from_obj(object);
442442
HashTable *debug_info,
@@ -446,7 +446,7 @@ static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /
446446
dom_prop_handler *entry;
447447
zend_string *object_str;
448448

449-
*is_temp = 1;
449+
*is_temp = true;
450450

451451
std_props = zend_std_get_properties(object);
452452
debug_info = zend_array_dup(std_props);
@@ -481,7 +481,7 @@ static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /
481481
}
482482
/* }}} */
483483

484-
static HashTable* dom_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
484+
static HashTable* dom_get_debug_info(zend_object *object, bool *is_temp) /* {{{ */
485485
{
486486
return dom_get_debug_info_helper(object, is_temp);
487487
}

ext/ffi/ffi.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,7 +2029,7 @@ static zend_object_iterator *zend_ffi_cdata_get_iterator(zend_class_entry *ce, z
20292029
}
20302030
/* }}} */
20312031

2032-
static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
2032+
static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, bool *is_temp) /* {{{ */
20332033
{
20342034
zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
20352035
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
@@ -2068,27 +2068,27 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp)
20682068
zend_ffi_cdata_to_zval(cdata, ptr, type, BP_VAR_R, &tmp, ZEND_FFI_FLAG_CONST, 0, 0);
20692069
ht = zend_new_array(1);
20702070
zend_hash_str_add(ht, "cdata", sizeof("cdata")-1, &tmp);
2071-
*is_temp = 1;
2071+
*is_temp = true;
20722072
return ht;
20732073
break;
20742074
case ZEND_FFI_TYPE_POINTER:
20752075
if (*(void**)ptr == NULL) {
20762076
ZVAL_NULL(&tmp);
20772077
ht = zend_new_array(1);
20782078
zend_hash_index_add_new(ht, 0, &tmp);
2079-
*is_temp = 1;
2079+
*is_temp = true;
20802080
return ht;
20812081
} else if (ZEND_FFI_TYPE(type->pointer.type)->kind == ZEND_FFI_TYPE_VOID) {
20822082
ZVAL_LONG(&tmp, (uintptr_t)*(void**)ptr);
20832083
ht = zend_new_array(1);
20842084
zend_hash_index_add_new(ht, 0, &tmp);
2085-
*is_temp = 1;
2085+
*is_temp = true;
20862086
return ht;
20872087
} else {
20882088
zend_ffi_cdata_to_zval(NULL, *(void**)ptr, ZEND_FFI_TYPE(type->pointer.type), BP_VAR_R, &tmp, ZEND_FFI_FLAG_CONST, 0, 0);
20892089
ht = zend_new_array(1);
20902090
zend_hash_index_add_new(ht, 0, &tmp);
2091-
*is_temp = 1;
2091+
*is_temp = true;
20922092
return ht;
20932093
}
20942094
break;
@@ -2106,7 +2106,7 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp)
21062106
}
21072107
}
21082108
} ZEND_HASH_FOREACH_END();
2109-
*is_temp = 1;
2109+
*is_temp = true;
21102110
return ht;
21112111
case ZEND_FFI_TYPE_ARRAY:
21122112
ht = zend_new_array(type->array.length);
@@ -2115,12 +2115,12 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp)
21152115
zend_hash_index_add(ht, n, &tmp);
21162116
ptr = (void*)(((char*)ptr) + ZEND_FFI_TYPE(type->array.type)->size);
21172117
}
2118-
*is_temp = 1;
2118+
*is_temp = true;
21192119
return ht;
21202120
case ZEND_FFI_TYPE_FUNC:
21212121
ht = zend_new_array(0);
21222122
// TODO: function name ???
2123-
*is_temp = 1;
2123+
*is_temp = true;
21242124
return ht;
21252125
break;
21262126
default:
@@ -2273,7 +2273,7 @@ static int zend_ffi_ctype_compare_objects(zval *o1, zval *o2) /* {{{ */
22732273
}
22742274
/* }}} */
22752275

2276-
static HashTable *zend_ffi_ctype_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
2276+
static HashTable *zend_ffi_ctype_get_debug_info(zend_object *obj, bool *is_temp) /* {{{ */
22772277
{
22782278
*is_temp = false;
22792279
return (HashTable*)&zend_empty_array;
@@ -5241,7 +5241,7 @@ static ZEND_COLD void zend_ffi_free_unset_property(zend_object *obj, zend_string
52415241
}
52425242
/* }}} */
52435243

5244-
static HashTable *zend_ffi_free_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
5244+
static HashTable *zend_ffi_free_get_debug_info(zend_object *obj, bool *is_temp) /* {{{ */
52455245
{
52465246
zend_ffi_use_after_free();
52475247
return NULL;

ext/gmp/gmp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ static zend_result gmp_cast_object(zend_object *readobj, zval *writeobj, int typ
305305
}
306306
/* }}} */
307307

308-
static HashTable *gmp_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
308+
static HashTable *gmp_get_debug_info(zend_object *obj, bool *is_temp) /* {{{ */
309309
{
310310
HashTable *ht, *props = zend_std_get_properties(obj);
311311
mpz_ptr gmpnum = GET_GMP_OBJECT_FROM_OBJ(obj)->num;
312312
zval zv;
313313

314-
*is_temp = 1;
314+
*is_temp = true;
315315
ht = zend_array_dup(props);
316316

317317
gmp_strval(&zv, gmpnum, 10);

ext/intl/breakiterator/breakiterator_class.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ static zend_object *BreakIterator_clone_obj(zend_object *object)
119119
/* }}} */
120120

121121
/* {{{ get_debug_info handler for BreakIterator */
122-
static HashTable *BreakIterator_get_debug_info(zend_object *object, int *is_temp)
122+
static HashTable *BreakIterator_get_debug_info(zend_object *object, bool *is_temp)
123123
{
124124
zval val;
125125
HashTable *debug_info;
126126
BreakIterator_object *bio;
127127
const BreakIterator *biter;
128128

129-
*is_temp = 1;
129+
*is_temp = true;
130130

131131
debug_info = zend_new_array(8);
132132

ext/intl/calendar/calendar_class.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ static const struct {
130130
};
131131

132132
/* {{{ get_debug_info handler for Calendar */
133-
static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp)
133+
static HashTable *Calendar_get_debug_info(zend_object *object, bool *is_temp)
134134
{
135135
zval zv,
136136
zfields;
137137
Calendar_object *co;
138138
const Calendar *cal;
139139
HashTable *debug_info;
140140

141-
*is_temp = 1;
141+
*is_temp = true;
142142

143143
debug_info = zend_new_array(8);
144144

@@ -156,10 +156,10 @@ static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp)
156156
ZVAL_STRING(&zv, const_cast<char*>(cal->getType()));
157157
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &zv);
158158
{
159-
zval ztz,
160-
ztz_debug;
161-
int is_tmp;
162-
HashTable *debug_info_tz;
159+
zval ztz,
160+
ztz_debug;
161+
bool is_tmp;
162+
HashTable *debug_info_tz;
163163

164164
timezone_object_construct(&cal->getTimeZone(), &ztz , 0);
165165
debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(Z_OBJ(ztz), &is_tmp);

ext/intl/timezone/timezone_class.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static int TimeZone_compare_objects(zval *object1, zval *object2)
275275
/* }}} */
276276

277277
/* {{{ get_debug_info handler for TimeZone */
278-
static HashTable *TimeZone_get_debug_info(zend_object *object, int *is_temp)
278+
static HashTable *TimeZone_get_debug_info(zend_object *object, bool *is_temp)
279279
{
280280
zval zv;
281281
TimeZone_object *to;
@@ -285,7 +285,7 @@ static HashTable *TimeZone_get_debug_info(zend_object *object, int *is_temp)
285285
HashTable *debug_info;
286286
UErrorCode uec = U_ZERO_ERROR;
287287

288-
*is_temp = 1;
288+
*is_temp = true;
289289

290290
debug_info = zend_new_array(8);
291291

ext/mysqli/mysqli.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static int mysqli_object_has_property(zend_object *object, zend_string *name, in
340340
return ret;
341341
} /* }}} */
342342

343-
HashTable *mysqli_object_get_debug_info(zend_object *object, int *is_temp)
343+
HashTable *mysqli_object_get_debug_info(zend_object *object, bool *is_temp)
344344
{
345345
mysqli_object *obj = php_mysqli_fetch_object(object);
346346
HashTable *retval, *props = obj->prop_handler;
@@ -358,7 +358,7 @@ HashTable *mysqli_object_get_debug_info(zend_object *object, int *is_temp)
358358
}
359359
} ZEND_HASH_FOREACH_END();
360360

361-
*is_temp = 1;
361+
*is_temp = true;
362362
return retval;
363363
}
364364

ext/simplexml/simplexml.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,9 +1181,9 @@ static HashTable *sxe_get_properties(zend_object *object) /* {{{ */
11811181
}
11821182
/* }}} */
11831183

1184-
static HashTable * sxe_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
1184+
static HashTable * sxe_get_debug_info(zend_object *object, bool *is_temp) /* {{{ */
11851185
{
1186-
*is_temp = 1;
1186+
*is_temp = true;
11871187
return sxe_get_prop_hash(object, 1);
11881188
}
11891189
/* }}} */

0 commit comments

Comments
 (0)