Change getline and getdelim return type to ssize_t.
[gnulib.git] / lib / getline.c
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);