[PATCH] Move _wrapup_reent() to new file
Joel Sherrill
joel.sherrill@oarcorp.com
Thu Apr 25 14:48:00 GMT 2013
I am OK with this. I was looking to see if the new file
should have some comment block at the top but
there is no notice in reent.c and the method isn't
public. So that doesn't leave much.
Corinna?
--joel
On 4/25/2013 4:12 AM, Sebastian Huber wrote:
> newlib/ChangeLog
> 2013-04-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
>
> * libc/reent/reent.c (_wrapup_reent): Move from here...
> * libc/reent/wrapupreent.c: ...to here. New file.
> * libc/reent/Makefile.am (GENERAL_SOURCES): Add wrapupreent.c.
> * libc/reent/Makefile.in: Regenerate.
> ---
> newlib/libc/reent/Makefile.am | 1 +
> newlib/libc/reent/Makefile.in | 12 ++++++++++--
> newlib/libc/reent/reent.c | 29 -----------------------------
> newlib/libc/reent/wrapupreent.c | 30 ++++++++++++++++++++++++++++++
> 4 files changed, 41 insertions(+), 31 deletions(-)
> create mode 100644 newlib/libc/reent/wrapupreent.c
>
> diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am
> index 9e0602d..71bd383 100644
> --- a/newlib/libc/reent/Makefile.am
> +++ b/newlib/libc/reent/Makefile.am
> @@ -52,6 +52,7 @@ GENERAL_SOURCES = \
> statr.c \
> timesr.c \
> unlinkr.c \
> + wrapupreent.c \
> writer.c
>
> libreent_la_LDFLAGS = -Xcompiler -nostdlib
> diff --git a/newlib/libc/reent/Makefile.in b/newlib/libc/reent/Makefile.in
> index 4be5f86..4060aea 100644
> --- a/newlib/libc/reent/Makefile.in
> +++ b/newlib/libc/reent/Makefile.in
> @@ -82,7 +82,7 @@ am__objects_1 = lib_a-closer.$(OBJEXT) lib_a-reent.$(OBJEXT) \
> lib_a-signalr.$(OBJEXT) lib_a-signgam.$(OBJEXT) \
> lib_a-sbrkr.$(OBJEXT) lib_a-statr.$(OBJEXT) \
> lib_a-timesr.$(OBJEXT) lib_a-unlinkr.$(OBJEXT) \
> - lib_a-writer.$(OBJEXT)
> + lib_a-wrapupreent.$(OBJEXT) lib_a-writer.$(OBJEXT)
> @HAVE_STDIO64_DIR_TRUE@am__objects_2 = lib_a-fstat64r.$(OBJEXT) \
> @HAVE_STDIO64_DIR_TRUE@ lib_a-lseek64r.$(OBJEXT) \
> @HAVE_STDIO64_DIR_TRUE@ lib_a-stat64r.$(OBJEXT) \
> @@ -102,7 +102,8 @@ libreent_la_LIBADD =
> am__objects_6 = closer.lo reent.lo impure.lo fcntlr.lo fstatr.lo \
> getreent.lo gettimeofdayr.lo isattyr.lo linkr.lo lseekr.lo \
> mkdirr.lo openr.lo readr.lo renamer.lo signalr.lo signgam.lo \
> - sbrkr.lo statr.lo timesr.lo unlinkr.lo writer.lo
> + sbrkr.lo statr.lo timesr.lo unlinkr.lo wrapupreent.lo \
> + writer.lo
> @HAVE_STDIO64_DIR_TRUE@am__objects_7 = fstat64r.lo lseek64r.lo \
> @HAVE_STDIO64_DIR_TRUE@ stat64r.lo open64r.lo
> am__objects_8 = $(am__objects_7)
> @@ -324,6 +325,7 @@ GENERAL_SOURCES = \
> statr.c \
> timesr.c \
> unlinkr.c \
> + wrapupreent.c \
> writer.c
>
> libreent_la_LDFLAGS = -Xcompiler -nostdlib
> @@ -548,6 +550,12 @@ lib_a-unlinkr.o: unlinkr.c
> lib_a-unlinkr.obj: unlinkr.c
> $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-unlinkr.obj `if test -f 'unlinkr.c'; then $(CYGPATH_W) 'unlinkr.c'; else $(CYGPATH_W) '$(srcdir)/unlinkr.c'; fi`
>
> +lib_a-wrapupreent.o: wrapupreent.c
> + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wrapupreent.o `test -f 'wrapupreent.c' || echo '$(srcdir)/'`wrapupreent.c
> +
> +lib_a-wrapupreent.obj: wrapupreent.c
> + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wrapupreent.obj `if test -f 'wrapupreent.c'; then $(CYGPATH_W) 'wrapupreent.c'; else $(CYGPATH_W) '$(srcdir)/wrapupreent.c'; fi`
> +
> lib_a-writer.o: writer.c
> $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-writer.o `test -f 'writer.c' || echo '$(srcdir)/'`writer.c
>
> diff --git a/newlib/libc/reent/reent.c b/newlib/libc/reent/reent.c
> index 63812db..63083fe 100644
> --- a/newlib/libc/reent/reent.c
> +++ b/newlib/libc/reent/reent.c
> @@ -120,32 +120,3 @@ _DEFUN (_reclaim_reent, (ptr),
>
> }
> }
> -
> -/*
> - * Do atexit() processing and cleanup
> - *
> - * NOTE: This is to be executed at task exit. It does not tear anything
> - * down which is used on a global basis.
> - */
> -
> -void
> -_DEFUN (_wrapup_reent, (ptr), struct _reent *ptr)
> -{
> - register struct _atexit *p;
> - register int n;
> -
> - if (ptr == NULL)
> - ptr = _REENT;
> -
> -#ifdef _REENT_SMALL
> - for (p = ptr->_atexit, n = p ? p->_ind : 0; --n >= 0;)
> - (*p->_fns[n]) ();
> -#else
> - for (p = ptr->_atexit; p; p = p->_next)
> - for (n = p->_ind; --n >= 0;)
> - (*p->_fns[n]) ();
> -#endif
> - if (ptr->__cleanup)
> - (*ptr->__cleanup) (ptr);
> -}
> -
> diff --git a/newlib/libc/reent/wrapupreent.c b/newlib/libc/reent/wrapupreent.c
> new file mode 100644
> index 0000000..309b095
> --- /dev/null
> +++ b/newlib/libc/reent/wrapupreent.c
> @@ -0,0 +1,30 @@
> +#include <reent.h>
> +#include <stddef.h>
> +
> +/*
> + * Do atexit() processing and cleanup
> + *
> + * NOTE: This is to be executed at task exit. It does not tear anything
> + * down which is used on a global basis.
> + */
> +
> +void
> +_DEFUN (_wrapup_reent, (ptr), struct _reent *ptr)
> +{
> + register struct _atexit *p;
> + register int n;
> +
> + if (ptr == NULL)
> + ptr = _REENT;
> +
> +#ifdef _REENT_SMALL
> + for (p = ptr->_atexit, n = p ? p->_ind : 0; --n >= 0;)
> + (*p->_fns[n]) ();
> +#else
> + for (p = ptr->_atexit; p; p = p->_next)
> + for (n = p->_ind; --n >= 0;)
> + (*p->_fns[n]) ();
> +#endif
> + if (ptr->__cleanup)
> + (*ptr->__cleanup) (ptr);
> +}
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the Newlib
mailing list