This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Protect some malloc functions with "MALLOC_PROVIDED"


Christopher Faylor wrote:
> 
> The below patches stop a few more functions from being compiled if
> MALLOC_PROVIDED is defined.  This duplicates functionality in other
> functions like "malloc.c" and "realloc.c".
> 
> Ok to checkin?
> 

Go ahead.  There is one small issue with this change. There are other platforms
that currently define MALLOC_PROVIDED but I doubt that they are using these
obscure functions and providing the necessary _r interfaces that would normally
be supplied by mallocr.c.  If this turns out to be a problem, I will add
a new flag (e.g. MALLOC_FAMILY_PROVIDED) to distinguish between the two
situations.

-- Jeff J.

> cgf
> 
> 2002-11-06  Christopher Faylor  <cgf@redhat.com>
> 
>         * libc/stdlib/malign.c: Don't compile if MALLOC_PROVIDED.
>         * libc/stdlib/mlock.c: Ditto.
>         * libc/stdlib/msize.c: Ditto.
>         * libc/stdlib/msize.c: Ditto.
>         * libc/stdlib/mtrim.c: Ditto.
>         * libc/stdlib/valloc.c: Ditto.
> 
> Index: libc/stdlib/malign.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libc/stdlib/malign.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 malign.c
> --- libc/stdlib/malign.c        17 Feb 2000 19:39:47 -0000      1.1.1.1
> +++ libc/stdlib/malign.c        7 Nov 2002 02:49:56 -0000
> @@ -1,3 +1,4 @@
> +#ifndef MALLOC_PROVIDED
>  /* malign.c -- a wrapper for memalign_r.  */
> 
>  #include <_ansi.h>
> @@ -15,4 +16,5 @@ _DEFUN (memalign, (align, nbytes),
>    return _memalign_r (_REENT, align, nbytes);
>  }
> 
> +#endif
>  #endif
> Index: libc/stdlib/mlock.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libc/stdlib/mlock.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 mlock.c
> --- libc/stdlib/mlock.c 24 Aug 2000 16:11:59 -0000      1.2
> +++ libc/stdlib/mlock.c 7 Nov 2002 02:49:56 -0000
> @@ -1,3 +1,4 @@
> +#ifndef MALLOC_PROVIDED
>  /*
>  FUNCTION
>  <<__malloc_lock>>, <<__malloc_unlock>>--lock malloc pool
> @@ -48,3 +49,4 @@ __malloc_unlock (ptr)
>       struct _reent *ptr;
>  {
>  }
> +#endif
> Index: libc/stdlib/msize.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libc/stdlib/msize.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 msize.c
> --- libc/stdlib/msize.c 17 Feb 2000 19:39:48 -0000      1.1.1.1
> +++ libc/stdlib/msize.c 7 Nov 2002 02:49:56 -0000
> @@ -1,3 +1,4 @@
> +#ifndef MALLOC_PROVIDED
>  /* msize.c -- a wrapper for malloc_usable_size.  */
> 
>  #include <_ansi.h>
> @@ -14,4 +15,5 @@ _DEFUN (malloc_usable_size, (ptr),
>    return _malloc_usable_size_r (_REENT, ptr);
>  }
> 
> +#endif
>  #endif
> Index: libc/stdlib/mtrim.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libc/stdlib/mtrim.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 mtrim.c
> --- libc/stdlib/mtrim.c 17 Feb 2000 19:39:48 -0000      1.1.1.1
> +++ libc/stdlib/mtrim.c 7 Nov 2002 02:49:56 -0000
> @@ -1,3 +1,4 @@
> +#ifndef MALLOC_PROVIDED
>  /* mtrim.c -- a wrapper for malloc_trim.  */
> 
>  #include <_ansi.h>
> @@ -14,4 +15,5 @@ _DEFUN (malloc_trim, (pad),
>    return _malloc_trim_r (_REENT, pad);
>  }
> 
> +#endif
>  #endif
> Index: libc/stdlib/valloc.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libc/stdlib/valloc.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 valloc.c
> --- libc/stdlib/valloc.c        17 Feb 2000 19:39:48 -0000      1.1.1.1
> +++ libc/stdlib/valloc.c        7 Nov 2002 02:49:56 -0000
> @@ -1,3 +1,4 @@
> +#ifndef MALLOC_PROVIDED
>  /* valloc.c -- a wrapper for valloc_r and pvalloc_r.  */
> 
>  #include <_ansi.h>
> @@ -21,4 +22,5 @@ _DEFUN (pvalloc, (nbytes),
>    return _pvalloc_r (_REENT, nbytes);
>  }
> 
> +#endif
>  #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]