]> granicus.if.org Git - php/commitdiff
Get rid of memcpy() in MAKE_NOP()
authorDmitry Stogov <dmitry@zend.com>
Thu, 6 Aug 2015 12:40:40 +0000 (15:40 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 6 Aug 2015 12:40:40 +0000 (15:40 +0300)
Zend/zend_compile.h
ext/opcache/Optimizer/zend_optimizer_internal.h

index 2db45e54fe71634f3f3d2ce4357a07359bbd6411..e3c2b00ea8fef381ce89b97eb8278bceb952e2ad 100644 (file)
 #define SET_UNUSED(op)  op ## _type = IS_UNUSED
 
 #define MAKE_NOP(opline) do { \
-       opline->opcode = ZEND_NOP; \
-       memset(&opline->result, 0, sizeof(opline->result)); \
-       memset(&opline->op1, 0, sizeof(opline->op1)); \
-       memset(&opline->op2, 0, sizeof(opline->op2)); \
-       opline->result_type = opline->op1_type = opline->op2_type = IS_UNUSED; \
+       (opline)->op1.num = 0; \
+       (opline)->op2.num = 0; \
+       (opline)->result.num = 0; \
+       (opline)->opcode = ZEND_NOP; \
+       (opline)->op1_type =  IS_UNUSED; \
+       (opline)->op2_type = IS_UNUSED; \
+       (opline)->result_type = IS_UNUSED; \
 } while (0)
 
 #define RESET_DOC_COMMENT() do { \
index c2f97ff715a332c6ff30981a1ae684614342da4d..ca452670d7515c6417a2df58c3afaebbc5cc0768 100644 (file)
 
 #undef MAKE_NOP
 
-#define MAKE_NOP(opline)   do { \
+#define MAKE_NOP(opline) do { \
+       (opline)->op1.num = 0; \
+       (opline)->op2.num = 0; \
+       (opline)->result.num = 0; \
        (opline)->opcode = ZEND_NOP; \
-       memset(&(opline)->result, 0, sizeof((opline)->result)); \
-       memset(&(opline)->op1, 0, sizeof((opline)->op1)); \
-       memset(&(opline)->op2, 0, sizeof((opline)->op2)); \
-       (opline)->result_type = (opline)->op1_type = (opline)->op2_type=IS_UNUSED; \
-       zend_vm_set_opcode_handler(opline); \
-} while (0);
+       (opline)->op1_type =  IS_UNUSED; \
+       (opline)->op2_type = IS_UNUSED; \
+       (opline)->result_type = IS_UNUSED; \
+        zend_vm_set_opcode_handler(opline); \
+} while (0)
+
 #define RESULT_USED(op)            (((op->result_type & IS_VAR) && !(op->result_type & EXT_TYPE_UNUSED)) || op->result_type == IS_TMP_VAR)
 #define RESULT_UNUSED(op)      ((op->result_type & EXT_TYPE_UNUSED) != 0)
 #define SAME_VAR(op1, op2)  ((((op1 ## _type & IS_VAR) && (op2 ## _type & IS_VAR)) || (op1 ## _type == IS_TMP_VAR && op2 ## _type == IS_TMP_VAR)) && op1.var == op2.var)