diff options
Diffstat (limited to 'Zend/zend_operators.h')
| -rw-r--r-- | Zend/zend_operators.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 6e7c1c01df..15ad79e4db 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -269,11 +269,11 @@ static inline zend_uchar is_numeric_string(const char *str, int length, long *lv return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL); } -static inline char * -zend_memnstr(char *haystack, char *needle, int needle_len, char *end) +static inline const char * +zend_memnstr(const char *haystack, const char *needle, int needle_len, char *end) { - char *p = haystack; - char ne = needle[needle_len-1]; + const char *p = haystack; + const char ne = needle[needle_len-1]; if (needle_len == 1) { return (char *)memchr(p, *needle, (end-p)); @@ -945,6 +945,24 @@ static zend_always_inline int fast_is_smaller_or_equal_function(zval *result, zv return Z_LVAL_P(result) <= 0; } +#define ZEND_TRY_BINARY_OBJECT_OPERATION(opcode) \ + if (Z_TYPE_P(op1) == IS_OBJECT && Z_OBJ_HANDLER_P(op1, do_operation)) { \ + if (SUCCESS == Z_OBJ_HANDLER_P(op1, do_operation)(opcode, result, op1, op2 TSRMLS_CC)) { \ + return SUCCESS; \ + } \ + } else if (Z_TYPE_P(op2) == IS_OBJECT && Z_OBJ_HANDLER_P(op2, do_operation)) { \ + if (SUCCESS == Z_OBJ_HANDLER_P(op2, do_operation)(opcode, result, op1, op2 TSRMLS_CC)) { \ + return SUCCESS; \ + } \ + } + +#define ZEND_TRY_UNARY_OBJECT_OPERATION(opcode) \ + if (Z_TYPE_P(op1) == IS_OBJECT && Z_OBJ_HANDLER_P(op1, do_operation) \ + && SUCCESS == Z_OBJ_HANDLER_P(op1, do_operation)(opcode, result, op1, NULL TSRMLS_CC) \ + ) { \ + return SUCCESS; \ + } + #endif /* |
