This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[patch] remove atoff
- From: Ralf Corsepius <ralf dot corsepius at rtems dot org>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Fri, 26 Aug 2011 15:44:06 +0200
- Subject: [patch] remove atoff
Hi,
I'd like to propose to remove "atoff" from newlib.
AFAICT, it's not covered by any current standard, I am aware about nor
can I find it implemented in Linux, FreeBSD or NetBSD.
I am inclined to believe it's historic ballast or a historic artifact in
newlib.
Patch to remove it enclosed below.
Ralf
2011-08-26 Ralf Corsépius <ralf.corsepius@rtems.org>
* libc/include/stdlib.h: Remove atoff.
* libc/stdlib/atoff.c: Remove.
* libc/stdlib/atof.c: Remove atoff.
* libc/stdlib/Makefile.am: Reflect removal of atoff.
* libc/stdlib/Makefile.in: Regenerate.
Index: libc/include/stdlib.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/stdlib.h,v
retrieving revision 1.40
diff -u -r1.40 stdlib.h
--- libc/include/stdlib.h 19 Jul 2010 18:21:11 -0000 1.40
+++ libc/include/stdlib.h 26 Aug 2011 13:21:33 -0000
@@ -63,9 +63,6 @@
int _EXFUN(abs,(int));
int _EXFUN(atexit,(_VOID (*__func)(_VOID)));
double _EXFUN(atof,(const char *__nptr));
-#ifndef __STRICT_ANSI__
-float _EXFUN(atoff,(const char *__nptr));
-#endif
int _EXFUN(atoi,(const char *__nptr));
int _EXFUN(_atoi_r,(struct _reent *, const char *__nptr));
long _EXFUN(atol,(const char *__nptr));
Index: libc/stdlib/Makefile.am
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/Makefile.am,v
retrieving revision 1.30
diff -u -r1.30 Makefile.am
--- libc/stdlib/Makefile.am 16 Apr 2009 18:24:35 -0000 1.30
+++ libc/stdlib/Makefile.am 26 Aug 2011 13:21:33 -0000
@@ -16,7 +16,6 @@
assert.c \
atexit.c \
atof.c \
- atoff.c \
atoi.c \
atol.c \
calloc.c \
Index: libc/stdlib/Makefile.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/Makefile.in,v
retrieving revision 1.47
diff -u -r1.47 Makefile.in
--- libc/stdlib/Makefile.in 16 Dec 2010 21:59:03 -0000 1.47
+++ libc/stdlib/Makefile.in 26 Aug 2011 13:21:34 -0000
@@ -69,8 +69,7 @@
lib_a-__ten_mu.$(OBJEXT) lib_a-_Exit.$(OBJEXT) \
lib_a-abort.$(OBJEXT) lib_a-abs.$(OBJEXT) \
lib_a-assert.$(OBJEXT) lib_a-atexit.$(OBJEXT) \
- lib_a-atof.$(OBJEXT) lib_a-atoff.$(OBJEXT) \
- lib_a-atoi.$(OBJEXT) lib_a-atol.$(OBJEXT) \
+ lib_a-atof.$(OBJEXT) lib_a-atoi.$(OBJEXT) lib_a-atol.$(OBJEXT) \
lib_a-calloc.$(OBJEXT) lib_a-div.$(OBJEXT) \
lib_a-dtoa.$(OBJEXT) lib_a-dtoastub.$(OBJEXT) \
lib_a-environ.$(OBJEXT) lib_a-envlock.$(OBJEXT) \
@@ -132,15 +131,15 @@
@HAVE_LONG_DOUBLE_TRUE@am__objects_8 = strtold.lo wcstold.lo
am__objects_9 = __adjust.lo __atexit.lo __call_atexit.lo __exp10.lo \
__ten_mu.lo _Exit.lo abort.lo abs.lo assert.lo atexit.lo \
- atof.lo atoff.lo atoi.lo atol.lo calloc.lo div.lo dtoa.lo \
- dtoastub.lo environ.lo envlock.lo eprintf.lo exit.lo \
- gdtoa-gethex.lo gdtoa-hexnan.lo getenv.lo getenv_r.lo labs.lo \
- ldiv.lo ldtoa.lo malloc.lo mblen.lo mblen_r.lo mbstowcs.lo \
- mbstowcs_r.lo mbtowc.lo mbtowc_r.lo mlock.lo mprec.lo \
- mstats.lo rand.lo rand_r.lo realloc.lo reallocf.lo \
- sb_charsets.lo strtod.lo strtol.lo strtoul.lo wcstod.lo \
- wcstol.lo wcstoul.lo wcstombs.lo wcstombs_r.lo wctomb.lo \
- wctomb_r.lo $(am__objects_8)
+ atof.lo atoi.lo atol.lo calloc.lo div.lo dtoa.lo dtoastub.lo \
+ environ.lo envlock.lo eprintf.lo exit.lo gdtoa-gethex.lo \
+ gdtoa-hexnan.lo getenv.lo getenv_r.lo labs.lo ldiv.lo ldtoa.lo \
+ malloc.lo mblen.lo mblen_r.lo mbstowcs.lo mbstowcs_r.lo \
+ mbtowc.lo mbtowc_r.lo mlock.lo mprec.lo mstats.lo rand.lo \
+ rand_r.lo realloc.lo reallocf.lo sb_charsets.lo strtod.lo \
+ strtol.lo strtoul.lo wcstod.lo wcstol.lo wcstoul.lo \
+ wcstombs.lo wcstombs_r.lo wctomb.lo wctomb_r.lo \
+ $(am__objects_8)
am__objects_10 = cxa_atexit.lo cxa_finalize.lo drand48.lo ecvtbuf.lo \
efgcvt.lo erand48.lo jrand48.lo lcong48.lo lrand48.lo \
mrand48.lo msize.lo mtrim.lo nrand48.lo rand48.lo seed48.lo \
@@ -330,13 +329,13 @@
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
GENERAL_SOURCES = __adjust.c __atexit.c __call_atexit.c __exp10.c \
__ten_mu.c _Exit.c abort.c abs.c assert.c atexit.c atof.c \
- atoff.c atoi.c atol.c calloc.c div.c dtoa.c dtoastub.c \
- environ.c envlock.c eprintf.c exit.c gdtoa-gethex.c \
- gdtoa-hexnan.c getenv.c getenv_r.c labs.c ldiv.c ldtoa.c \
- malloc.c mblen.c mblen_r.c mbstowcs.c mbstowcs_r.c mbtowc.c \
- mbtowc_r.c mlock.c mprec.c mstats.c rand.c rand_r.c realloc.c \
- reallocf.c sb_charsets.c strtod.c strtol.c strtoul.c wcstod.c \
- wcstol.c wcstoul.c wcstombs.c wcstombs_r.c wctomb.c wctomb_r.c \
+ atoi.c atol.c calloc.c div.c dtoa.c dtoastub.c environ.c \
+ envlock.c eprintf.c exit.c gdtoa-gethex.c gdtoa-hexnan.c \
+ getenv.c getenv_r.c labs.c ldiv.c ldtoa.c malloc.c mblen.c \
+ mblen_r.c mbstowcs.c mbstowcs_r.c mbtowc.c mbtowc_r.c mlock.c \
+ mprec.c mstats.c rand.c rand_r.c realloc.c reallocf.c \
+ sb_charsets.c strtod.c strtol.c strtoul.c wcstod.c wcstol.c \
+ wcstoul.c wcstombs.c wcstombs_r.c wctomb.c wctomb_r.c \
$(am__append_1)
EXTENDED_SOURCES = \
cxa_atexit.c \
@@ -616,12 +615,6 @@
lib_a-atof.obj: atof.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atof.obj `if test -f 'atof.c'; then $(CYGPATH_W) 'atof.c'; else $(CYGPATH_W) '$(srcdir)/atof.c'; fi`
-lib_a-atoff.o: atoff.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atoff.o `test -f 'atoff.c' || echo '$(srcdir)/'`atoff.c
-
-lib_a-atoff.obj: atoff.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atoff.obj `if test -f 'atoff.c'; then $(CYGPATH_W) 'atoff.c'; else $(CYGPATH_W) '$(srcdir)/atoff.c'; fi`
-
lib_a-atoi.o: atoi.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atoi.o `test -f 'atoi.c' || echo '$(srcdir)/'`atoi.c
Index: libc/stdlib/atof.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/atof.c,v
retrieving revision 1.3
diff -u -r1.3 atof.c
--- libc/stdlib/atof.c 20 Oct 2003 18:46:37 -0000 1.3
+++ libc/stdlib/atof.c 26 Aug 2011 13:21:34 -0000
@@ -1,28 +1,22 @@
/*
FUNCTION
- <<atof>>, <<atoff>>---string to double or float
+ <<atof>>---string to double
INDEX
atof
-INDEX
- atoff
ANSI_SYNOPSIS
#include <stdlib.h>
double atof(const char *<[s]>);
- float atoff(const char *<[s]>);
TRAD_SYNOPSIS
#include <stdlib.h>
double atof(<[s]>)
char *<[s]>;
- float atoff(<[s]>)
- char *<[s]>;
DESCRIPTION
<<atof>> converts the initial portion of a string to a <<double>>.
-<<atoff>> converts the initial portion of a string to a <<float>>.
The functions parse the character string <[s]>,
locating a substring which can be converted to a floating-point
@@ -36,7 +30,6 @@
something other than <<+>>, <<->>, <<.>>, or a digit.
<<atof(<[s]>)>> is implemented as <<strtod(<[s]>, NULL)>>.
-<<atoff(<[s]>)>> is implemented as <<strtof(<[s]>, NULL)>>.
RETURNS
<<atof>> returns the converted substring value, if any, as a
@@ -47,12 +40,9 @@
If the correct value would cause underflow, <<0.0>> is returned
and <<ERANGE>> is stored in <<errno>>.
-<<atoff>> obeys the same rules as <<atof>>, except that it
-returns a <<float>>.
-
PORTABILITY
-<<atof>> is ANSI C. <<atof>>, <<atoi>>, and <<atol>> are subsumed by <<strod>>
-and <<strol>>, but are used extensively in existing code. These functions are
+<<atof>> is ANSI C. <<atof>>, <<atoi>>, and <<atol>> are subsumed by <<strtod>>
+and <<strtol>>, but are used extensively in existing code. These functions are
less reliable, but may be faster if the argument is verified to be in a valid
range.
Index: libc/stdlib/atoff.c
===================================================================
RCS file: libc/stdlib/atoff.c
diff -N libc/stdlib/atoff.c
--- libc/stdlib/atoff.c 6 Dec 2002 18:58:51 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-#include <stdlib.h>
-#include <_ansi.h>
-
-float
-_DEFUN (atoff, (s),
- _CONST char *s)
-{
- return strtof (s, NULL);
-}