fgetln: Cleanup function Reindent, remove commented code and translate variable names to english
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/ChangeLog b/ChangeLog
index f7f21be..4169bdb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
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.
* Makefile: Add versioned symbols support.
diff --git a/fgetln.c b/fgetln.c
index 4e9b7c1..ce2f22a 100644
--- 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
+