com php-src: Drop the unneeded pointer casting: Zend/zend_all oc.c
| From: | George Peter Banyard | Date: | Mon, 03 Aug 2020 01:05:14 +0000 |
| Subject: | com php-src: Drop the unneeded pointer casting: Zend/zend_all oc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112490@lists.php.net to get a copy of this message | ||
Commit: 7d4ae7fa235301031590a774802fc343e3e42856
Author: tangl163 <cnjsw001@gmail.com> Sat, 1 Aug 2020 11:56:16 +0800
Committer: George Peter Banyard <girgias@php.net> Mon, 3 Aug 2020 02:05:14 +0100
Parents: 90434d7fe3ac204b56b85cf8ca606e7dd8cf27ac
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7d4ae7fa235301031590a774802fc343e3e42856
Log:
Drop the unneeded pointer casting
The standard says that "A pointer to void may be converted to or from a
pointer to any object type". So the casting is unneeded.
REF:
* c11: http://port70.net/~nsz/c/c11/n1570.html#6.3.2.3p1
* c99: http://port70.net/~nsz/c/c99/n1256.html
Closes GH-5916
Bugs:
https://bugs.php.net/6
Changed paths:
M Zend/zend_alloc.c
Diff:
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 753a8b830d..2236cf0dbb 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -1236,7 +1236,7 @@ static zend_never_inline void *zend_mm_alloc_small_slow(zend_mm_heap *heap,
uint
#endif
/* return first element */
- return (char*)bin;
+ return bin;
}
static zend_always_inline void *zend_mm_alloc_small(zend_mm_heap *heap, int bin_num
ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
@@ -1253,7 +1253,7 @@ static zend_always_inline void *zend_mm_alloc_small(zend_mm_heap *heap, int
bin_
if (EXPECTED(heap->free_slot[bin_num] != NULL)) {
zend_mm_free_slot *p = heap->free_slot[bin_num];
heap->free_slot[bin_num] = p->next_free_slot;
- return (void*)p;
+ return p;
} else {
return zend_mm_alloc_small_slow(heap, bin_num ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_ORIG_RELAY_CC);
}