Change getline and getdelim return type to ssize_t.
authorBruno Haible <bruno@clisp.org>
Thu, 24 Jul 2003 15:23:15 +0000 (15:23 +0000)
committerBruno Haible <bruno@clisp.org>
Thu, 24 Jul 2003 15:23:15 +0000 (15:23 +0000)
lib/ChangeLog
lib/getline.c
lib/getline.h

index 54eb58b..8ea91f7 100644 (file)
@@ -1,3 +1,11 @@
+2003-07-24  Derek Robert Price  <derek@ximbiot.com>
+            Bruno Haible  <bruno@clisp.org>
+
+       * 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  <eggert@twinsun.com>
 
        * xalloc.h (XCALLOC, XREALLOC, CCLONE): Fix under- and
index 6cd9503..a4d09ea 100644 (file)
 /* 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 <stddef.h>
 #include <stdio.h>
 
+/* Get ssize_t.  */
+#include <sys/types.h>
+
 #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);
index 0bf8a25..ee9fc05 100644 (file)
@@ -23,13 +23,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 # include <stddef.h>
 # include <stdio.h>
 
+/* Get ssize_t.  */
+# include <sys/types.h>
+
 /* glibc2 has these functions declared in <stdio.h>.  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