Skip to content

Commit

Permalink
Drop the unneeded pointer casting
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tangl163 authored and Girgias committed Aug 3, 2020
1 parent 90434d7 commit 7d4ae7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down

0 comments on commit 7d4ae7f

Please sign in to comment.