com php-src: Remove dubious memcmp optimization in iconv: ext/iconv/iconv.c
| From: | Nikita Popov | Date: | Fri, 12 Apr 2019 13:12:39 +0000 |
| Subject: | com php-src: Remove dubious memcmp optimization in iconv: ext/iconv/iconv.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105699@lists.php.net to get a copy of this message | ||
Commit: 4b1491a7b1cb334f9d1f552d21ea1a4448fb3c40
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 12 Apr 2019 15:10:17 +0200
Parents: b6b98bdf641c9d054638c60ec9bb3199d3164303
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4b1491a7b1cb334f9d1f552d21ea1a4448fb3c40
Log:
Remove dubious memcmp optimization in iconv
This violates strict aliasing, and appears entirely unnecessary --
the compiler can optimize fixed size memcmp's by itself.
Changed paths:
M ext/iconv/iconv.c
Diff:
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 0e85a5c..62f7cb3 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -55,7 +55,7 @@
#include "ext/standard/quot_print.h"
#define _php_iconv_memequal(a, b, c) \
- ((c) == sizeof(zend_ulong) ? *((zend_ulong *)(a)) == *((zend_ulong *)(b)) : ((c) ==
sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0))
+ (memcmp(a, b, c) == 0)
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strlen, 0, 0, 1)