Rework malloc's long_sub_size_t
Richard Sandiford
rsandifo@redhat.com
Fri Oct 11 06:15:00 GMT 2002
"J. Johnston" <jjohnstn@redhat.com> writes:
> The patch is fine Richard, but please also remove the references in
> libc/include/sys/config.h since they are no longer used.
Thanks, applied with that change. For the record,
here's what I checked in...
2002-10-11 Graham Stott <graham.stott@btinternet.com>
Richard Sandiford <rsandifo@redhat.com>
* libc/include/sys/config.h (SIZE_T_SMALLER_THAN_LONG): Undefine.
* libc/stdlib/mallocr.c (long_sub_size_t): Define in a way that
doesn't require the SIZE_T_SMALLER_THAN_LONG macro.
Index: libc/include/sys/config.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v
retrieving revision 1.33
diff -c -d -p -r1.33 config.h
*** libc/include/sys/config.h 20 Sep 2002 17:11:29 -0000 1.33
--- libc/include/sys/config.h 11 Oct 2002 10:25:51 -0000
***************
*** 91,97 ****
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
- #define SIZE_T_SMALLER_THAN_LONG
#define MALLOC_ALIGNMENT 8
#define _POINTER_INT short
#define __BUFSIZ__ 16
--- 91,96 ----
Index: libc/stdlib/mallocr.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/mallocr.c,v
retrieving revision 1.8
diff -c -d -p -r1.8 mallocr.c
*** libc/stdlib/mallocr.c 20 Aug 2002 15:29:30 -0000 1.8
--- libc/stdlib/mallocr.c 11 Oct 2002 10:25:51 -0000
*************** int _dummy_mallocr = 1;
*** 168,177 ****
MALLOC_ALIGNMENT (default: NOT defined)
Define this to 16 if you need 16 byte alignment instead of 8 byte alignment
which is the normal default.
- SIZE_T_SMALLER_THAN_LONG (default: NOT defined)
- Define this when the platform you are compiling has sizeof(long) > sizeof(size_t).
- The option causes some extra code to be generated to handle operations
- that use size_t operands and have long results.
REALLOC_ZERO_BYTES_FREES (default: NOT defined)
Define this if you think that realloc(p, 0) should be equivalent
to free(p). Otherwise, since malloc returns a unique pointer for
--- 168,173 ----
*************** extern void __malloc_unlock();
*** 448,458 ****
fact that assignment from unsigned to signed won't sign extend.
*/
! #ifdef SIZE_T_SMALLER_THAN_LONG
! #define long_sub_size_t(x, y) ( (x < y) ? -((long)(y - x)) : (x - y) );
! #else
! #define long_sub_size_t(x, y) ( (long)(x - y) )
! #endif
/*
REALLOC_ZERO_BYTES_FREES should be set if a call to
--- 444,453 ----
fact that assignment from unsigned to signed won't sign extend.
*/
! #define long_sub_size_t(x, y) \
! (sizeof (long) > sizeof (INTERNAL_SIZE_T) && x < y \
! ? -(long) (y - x) \
! : (long) (x - y))
/*
REALLOC_ZERO_BYTES_FREES should be set if a call to
More information about the Newlib
mailing list