]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
fgetln: Cleanup function
authorGuillem Jover <guillem@hadrons.org>
Mon, 25 Jul 2005 00:07:29 +0000 (00:07 +0000)
committerGuillem Jover <guillem@hadrons.org>
Tue, 6 May 2008 05:42:49 +0000 (08:42 +0300)
Reindent, remove commented code and translate variable names to english

ChangeLog
fgetln.c

index f7f21bebf5abf3157e9a375fca094934d42faf7c..4169bdbbfc7c584c6bb8ec58444f79b2b78460d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-25  Guillem Jover  <guillem@debian.org>
+
+       * fgetln.c (fgetln): Reindent, remove commented code and translate
+       variable names to english.
+
 2005-07-25  Guillem Jover  <guillem@debian.org>
 
        * Versions: New file.
index 4e9b7c1692cc67af2ba09ecb13d84cc3e89f896d..ce2f22ad21afe1b90cb06798a0eb31080f8194bb 100644 (file)
--- a/fgetln.c
+++ b/fgetln.c
@@ -9,24 +9,20 @@ char *
 fgetln (stream, len)
        FILE *stream;
        size_t *len;
-
 {
        char *line=NULL;
-       size_t leido = 0;
-       
-       while (leido == 1) {
-       if ((leido = getline (&line, len, stream)) == -1)
-               return NULL;
+       size_t nread = 0;
+
+       while (nread == 1) {
+               nread = getline (&line, len, stream);
+               if (nread == -1)
+                       return NULL;
        }
 
-//     if (*(line+leido) != '\n')
-//     if (leido != 0)
-               (*len)--; /* get rid of the trailing \0, fgetln
-                            does not have it */
-//     if (leido == 1)
-//             leido = getline (&line, len, stream);
+       (*len)--; /* get rid of the trailing \0, fgetln
+                    does not have it */
 
-//     printf ("Caracter '%c' - Leido '%d'\n", *(line+leido-1), leido);
        return line;
 }
 #endif
+