Skip to content

Commit

Permalink
Do not cast pointer to size_t in GET_MEM definition
Browse files Browse the repository at this point in the history
(refactoring)

Issue #627 (bdwgc).

* include/private/gcconfig.h [GC_PRIVATE_H && !OS2 && (NEXT || DOS4GW
|| NONSTOP || SOLARIS && !USE_MMAP || RTEMS || EMBOX || KOS
|| __CC_ARM)] (GET_MEM): Cast calloc() result to ptr_t instead of
size_t.
  • Loading branch information
ivmai committed Oct 29, 2024
1 parent f99635f commit 7872917
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -3436,8 +3436,8 @@ void *os2_alloc(size_t bytes);
# if defined(REDIRECT_MALLOC) && !defined(CPPCHECK)
# error Malloc redirection is unsupported
# endif
# define GET_MEM(bytes) \
HBLKPTR((size_t)calloc(1, SIZET_SAT_ADD(bytes, GC_page_size)) \
# define GET_MEM(bytes) \
HBLKPTR((ptr_t)calloc(1, SIZET_SAT_ADD(bytes, GC_page_size)) \
+ GC_page_size - 1)
# elif defined(MSWIN_XBOX1)
ptr_t GC_durango_get_mem(size_t bytes);
Expand Down

0 comments on commit 7872917

Please sign in to comment.