From: Bruno Haible Date: Thu, 24 Jul 2003 15:23:15 +0000 (+0000) Subject: Change getline and getdelim return type to ssize_t. X-Git-Tag: cvs-readonly~4702 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=572ca05661319aeaef3de1afa9ec1e8c91e6acd4;p=gnulib.git Change getline and getdelim return type to ssize_t. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 54eb58b77..8ea91f71b 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,11 @@ +2003-07-24 Derek Robert Price + Bruno Haible + + * getline.h (getline, getdelim): Change return type to ssize_t. + * getline.c (getline, getdelim): Likewise. + Remove _GNU_SOURCE define; now it's defined in config.h through + m4/getline.m4. + 2003-07-22 Paul Eggert * xalloc.h (XCALLOC, XREALLOC, CCLONE): Fix under- and diff --git a/lib/getline.c b/lib/getline.c index 6cd950327..a4d09ea6b 100644 --- a/lib/getline.c +++ b/lib/getline.c @@ -26,18 +26,15 @@ /* Specification. */ #include "getline.h" -/* The `getdelim' function is only declared if the following symbol - is defined. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - #include #include +/* Get ssize_t. */ +#include + #if defined __GNU_LIBRARY__ && HAVE_GETDELIM -int +ssize_t getline (char **lineptr, size_t *linesize, FILE *stream) { return getdelim (lineptr, linesize, '\n', stream); @@ -47,13 +44,13 @@ getline (char **lineptr, size_t *linesize, FILE *stream) #include "getndelim2.h" -int +ssize_t getline (char **lineptr, size_t *linesize, FILE *stream) { return getndelim2 (lineptr, linesize, (size_t)(-1), stream, '\n', 0, 0); } -int +ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter, FILE *stream) { return getndelim2 (lineptr, linesize, (size_t)(-1), stream, delimiter, 0, 0); diff --git a/lib/getline.h b/lib/getline.h index 0bf8a2552..ee9fc052c 100644 --- a/lib/getline.h +++ b/lib/getline.h @@ -23,13 +23,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # include # include +/* Get ssize_t. */ +# include + /* glibc2 has these functions declared in . Avoid redeclarations. */ # if __GLIBC__ < 2 -extern int getline (char **_lineptr, size_t *_linesize, FILE *_stream); +extern ssize_t getline (char **_lineptr, size_t *_linesize, FILE *_stream); -extern int getdelim (char **_lineptr, size_t *_linesize, int _delimiter, - FILE *_stream); +extern ssize_t getdelim (char **_lineptr, size_t *_linesize, int _delimiter, + FILE *_stream); # endif