Skip to content

Commit edf10a4

Browse files
committed
Additional purity
1 parent 814243a commit edf10a4

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

Zend/zend_API.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ ZEND_API ZEND_COLD void zend_wrong_property_read(zval *object, zval *property)
116116
}
117117

118118
/* Argument parsing API -- andrei */
119-
ZEND_API const char *zend_get_type_by_const(int type) /* {{{ */
119+
ZEND_ATTRIBUTE_CONST ZEND_API const char *zend_get_type_by_const(int type) /* {{{ */
120120
{
121121
switch(type) {
122122
case IS_FALSE:
@@ -152,7 +152,7 @@ ZEND_API const char *zend_get_type_by_const(int type) /* {{{ */
152152
}
153153
/* }}} */
154154

155-
ZEND_API const char *zend_zval_value_name(const zval *arg)
155+
ZEND_ATTRIBUTE_PURE ZEND_API const char *zend_zval_value_name(const zval *arg)
156156
{
157157
ZVAL_DEREF(arg);
158158

@@ -171,7 +171,7 @@ ZEND_API const char *zend_zval_value_name(const zval *arg)
171171
return zend_get_type_by_const(Z_TYPE_P(arg));
172172
}
173173

174-
ZEND_API const char *zend_zval_type_name(const zval *arg)
174+
ZEND_ATTRIBUTE_PURE ZEND_API const char *zend_zval_type_name(const zval *arg)
175175
{
176176
ZVAL_DEREF(arg);
177177

@@ -3762,7 +3762,7 @@ ZEND_API zend_result zend_disable_class(const char *class_name, size_t class_nam
37623762
}
37633763
/* }}} */
37643764

3765-
static zend_always_inline zend_class_entry *get_scope(zend_execute_data *frame)
3765+
ZEND_ATTRIBUTE_PURE static zend_always_inline zend_class_entry *get_scope(const zend_execute_data *frame)
37663766
{
37673767
return frame && frame->func ? frame->func->common.scope : NULL;
37683768
}

Zend/zend_API.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ ZEND_API zend_result zend_parse_parameters_ex(int flags, uint32_t num_args, cons
366366
/* NOTE: This must have at least one value in __VA_ARGS__ for the expression to be valid */
367367
#define zend_parse_parameters_throw(num_args, ...) \
368368
zend_parse_parameters(num_args, __VA_ARGS__)
369-
ZEND_API const char *zend_zval_type_name(const zval *arg);
370-
ZEND_API const char *zend_zval_value_name(const zval *arg);
369+
ZEND_ATTRIBUTE_PURE ZEND_API const char *zend_zval_type_name(const zval *arg);
370+
ZEND_ATTRIBUTE_PURE ZEND_API const char *zend_zval_value_name(const zval *arg);
371371
ZEND_API zend_string *zend_zval_get_legacy_type(const zval *arg);
372372

373373
ZEND_API zend_result zend_parse_method_parameters(uint32_t num_args, zval *this_ptr, const char *type_spec, ...);
@@ -520,7 +520,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zend_object *object,
520520
ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, bool silent);
521521
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, bool silent);
522522

523-
ZEND_API const char *zend_get_type_by_const(int type);
523+
ZEND_ATTRIBUTE_CONST ZEND_API const char *zend_get_type_by_const(int type);
524524

525525
#define ZEND_THIS (&EX(This))
526526

Zend/zend_execute.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,12 @@ ZEND_API void ZEND_FASTCALL zend_free_extra_named_params(zend_array *extra_named
443443

444444
/* services */
445445
ZEND_API const char *get_active_class_name(const char **space);
446-
ZEND_API const char *get_active_function_name(void);
447-
ZEND_API const char *get_active_function_arg_name(uint32_t arg_num);
448-
ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t arg_num);
449-
ZEND_API zend_function *zend_active_function_ex(zend_execute_data *execute_data);
446+
ZEND_ATTRIBUTE_PURE ZEND_API const char *get_active_function_name(void);
447+
ZEND_ATTRIBUTE_PURE ZEND_API const char *get_active_function_arg_name(uint32_t arg_num);
448+
ZEND_ATTRIBUTE_PURE ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t arg_num);
449+
ZEND_ATTRIBUTE_PURE ZEND_API zend_function *zend_active_function_ex(const zend_execute_data *execute_data);
450450

451-
static zend_always_inline zend_function *zend_active_function(void)
451+
ZEND_ATTRIBUTE_PURE static zend_always_inline zend_function *zend_active_function(void)
452452
{
453453
zend_function *func = EG(current_execute_data)->func;
454454
if (ZEND_USER_CODE(func->type)) {
@@ -464,7 +464,7 @@ ZEND_ATTRIBUTE_PURE ZEND_API const char *zend_get_executed_filename(void);
464464
ZEND_ATTRIBUTE_PURE ZEND_API zend_string *zend_get_executed_filename_ex(void);
465465
ZEND_ATTRIBUTE_PURE ZEND_API uint32_t zend_get_executed_lineno(void);
466466
ZEND_ATTRIBUTE_PURE ZEND_API zend_class_entry *zend_get_executed_scope(void);
467-
ZEND_API bool zend_is_executing(void);
467+
ZEND_ATTRIBUTE_PURE ZEND_API bool zend_is_executing(void);
468468
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_cannot_pass_by_reference(uint32_t arg_num);
469469

470470
ZEND_API void zend_set_timeout(zend_long seconds, bool reset_signals);

Zend/zend_execute_API.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ ZEND_API const char *get_active_class_name(const char **space) /* {{{ */
567567
}
568568
/* }}} */
569569

570-
ZEND_API const char *get_active_function_name(void) /* {{{ */
570+
ZEND_ATTRIBUTE_PURE ZEND_API const char *get_active_function_name(void) /* {{{ */
571571
{
572572
zend_function *func;
573573

@@ -597,7 +597,7 @@ ZEND_API const char *get_active_function_name(void) /* {{{ */
597597
}
598598
/* }}} */
599599

600-
ZEND_API zend_function *zend_active_function_ex(zend_execute_data *execute_data)
600+
ZEND_ATTRIBUTE_PURE ZEND_API zend_function *zend_active_function_ex(const zend_execute_data *execute_data)
601601
{
602602
zend_function *func = EX(func);
603603

@@ -630,7 +630,7 @@ ZEND_API zend_string *get_function_or_method_name(const zend_function *func) /*
630630
}
631631
/* }}} */
632632

633-
ZEND_API const char *get_active_function_arg_name(uint32_t arg_num) /* {{{ */
633+
ZEND_ATTRIBUTE_PURE ZEND_API const char *get_active_function_arg_name(uint32_t arg_num) /* {{{ */
634634
{
635635
if (!zend_is_executing()) {
636636
return NULL;
@@ -642,7 +642,7 @@ ZEND_API const char *get_active_function_arg_name(uint32_t arg_num) /* {{{ */
642642
}
643643
/* }}} */
644644

645-
ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t arg_num) /* {{{ */
645+
ZEND_ATTRIBUTE_PURE ZEND_API const char *get_function_arg_name(const zend_function *func, uint32_t arg_num) /* {{{ */
646646
{
647647
if (!func || arg_num == 0 || func->common.num_args < arg_num) {
648648
return NULL;
@@ -726,7 +726,7 @@ ZEND_ATTRIBUTE_PURE ZEND_API zend_class_entry *zend_get_executed_scope(void) /*
726726
}
727727
/* }}} */
728728

729-
ZEND_API bool zend_is_executing(void) /* {{{ */
729+
ZEND_ATTRIBUTE_PURE ZEND_API bool zend_is_executing(void) /* {{{ */
730730
{
731731
return EG(current_execute_data) != 0;
732732
}

0 commit comments

Comments
 (0)