]> granicus.if.org Git - php/commitdiff
Drop the unneeded pointer casting
authortangl163 <cnjsw001@gmail.com>
Sat, 1 Aug 2020 03:56:16 +0000 (11:56 +0800)
committerGeorge Peter Banyard <girgias@php.net>
Mon, 3 Aug 2020 01:05:14 +0000 (02:05 +0100)
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

Zend/zend_alloc.c

index 753a8b830d4e37eaca1e1f30053e5f747061b35f..2236cf0dbb0370e324f10ca42848c91421570a3e 100644 (file)
@@ -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);
        }