[hackers] [sbase] remove agetline || Evan Gates

From: <git_AT_suckless.org>
Date: Tue, 18 Nov 2014 22:05:32 +0100

commit 84b08427a167f5729f7cd439a4eb260ece98e7b5
Author: Evan Gates <evan.gates_AT_gmail.com>
Date: Tue Nov 18 12:49:30 2014 -0800

    remove agetline

diff --git a/Makefile b/Makefile
index f60985c..1f01866 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -27,7 +27,6 @@ LIBUTFSRC =\
 LIBUTIL = libutil.a
 LIBUTILSRC =\
         libutil/agetcwd.c\
- libutil/agetline.c\
         libutil/apathmax.c\
         libutil/concat.c\
         libutil/cp.c\
diff --git a/cut.c b/cut.c
index 97d2f2a..0206e47 100644
--- a/cut.c
+++ b/cut.c
_AT_@ -121,7 +121,7 @@ cut(FILE *fp)
         ssize_t len;
         Range *r;
 
- while ((len = agetline(&buf, &size, fp)) != -1) {
+ while ((len = getline(&buf, &size, fp)) != -1) {
                 if (len && buf[len - 1] == '\n')
                         buf[len - 1] = '\0';
                 if (mode == 'f' && !strchr(buf, delim)) {
diff --git a/fold.c b/fold.c
index 92585af..735b53b 100644
--- a/fold.c
+++ b/fold.c
_AT_@ -64,7 +64,7 @@ fold(FILE *fp, long width)
         char *buf = NULL;
         size_t size = 0;
 
- while (agetline(&buf, &size, fp) != -1)
+ while (getline(&buf, &size, fp) != -1)
                 foldline(buf, width);
         free(buf);
 }
diff --git a/grep.c b/grep.c
index dc379d5..08d0b0a 100644
--- a/grep.c
+++ b/grep.c
_AT_@ -132,7 +132,7 @@ grep(FILE *fp, const char *str)
         struct pattern *pnode;
         int match = NoMatch;
 
- for (n = 1; (len = agetline(&buf, &size, fp)) != -1; n++) {
+ for (n = 1; (len = getline(&buf, &size, fp)) != -1; n++) {
                 /* Remove the trailing newline if one is present. */
                 if (len && buf[len - 1] == '\n')
                         buf[len - 1] = '\0';
diff --git a/head.c b/head.c
index 6f32177..f2c6206 100644
--- a/head.c
+++ b/head.c
_AT_@ -56,7 +56,7 @@ head(FILE *fp, const char *str, long n)
         ssize_t len;
         unsigned long i = 0;
 
- while (i < n && ((len = agetline(&buf, &size, fp)) != -1)) {
+ while (i < n && ((len = getline(&buf, &size, fp)) != -1)) {
                 fputs(buf, stdout);
                 if (buf[len - 1] == '\n')
                         i++;
diff --git a/libutil/agetline.c b/libutil/agetline.c
deleted file mode 100644
index 0953dac..0000000
--- a/libutil/agetline.c
+++ /dev/null
_AT_@ -1,13 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../text.h"
-#include "../util.h"
-
-ssize_t
-agetline(char **p, size_t *size, FILE *fp)
-{
- return getline(p, size, fp);
-}
diff --git a/libutil/crypt.c b/libutil/crypt.c
index 458f11c..2d2ab39 100644
--- a/libutil/crypt.c
+++ b/libutil/crypt.c
_AT_@ -51,7 +51,7 @@ cryptcheck(char *sumfile, int argc, char *argv[],
         else if (!(cfp = fopen(sumfile, "r")))
                 eprintf("fopen %s:", sumfile);
 
- while (agetline(&line, &bufsiz, cfp) != -1) {
+ while (getline(&line, &bufsiz, cfp) != -1) {
                 if (!(file = strstr(line, " "))) {
                         formatsucks++;
                         continue;
diff --git a/libutil/getlines.c b/libutil/getlines.c
index df64544..55e9bf4 100644
--- a/libutil/getlines.c
+++ b/libutil/getlines.c
_AT_@ -13,7 +13,7 @@ getlines(FILE *fp, struct linebuf *b)
         size_t size = 0, linelen;
         ssize_t len;
 
- while ((len = agetline(&line, &size, fp)) != -1) {
+ while ((len = getline(&line, &size, fp)) != -1) {
                 if (++b->nlines > b->capacity) {
                         b->capacity += 512;
                         nline = erealloc(b->lines, b->capacity * sizeof(*b->lines));
diff --git a/nl.c b/nl.c
index 3557362..17e4177 100644
--- a/nl.c
+++ b/nl.c
_AT_@ -69,7 +69,7 @@ nl(FILE *fp)
         long n = 0;
         size_t size = 0;
 
- while (agetline(&buf, &size, fp) != -1) {
+ while (getline(&buf, &size, fp) != -1) {
                 if ((mode == 'a')
                     || (mode == 'p'
                         && !regexec(&preg, buf, 0, NULL, 0))
diff --git a/tail.c b/tail.c
index b53ec8d..b399cf2 100644
--- a/tail.c
+++ b/tail.c
_AT_@ -61,7 +61,7 @@ dropinit(FILE *fp, const char *str, long n)
         ssize_t len;
         unsigned long i = 0;
 
- while (i < n && ((len = agetline(&buf, &size, fp)) != -1))
+ while (i < n && ((len = getline(&buf, &size, fp)) != -1))
                 if (len && buf[len - 1] == '\n')
                         i++;
         free(buf);
_AT_@ -78,7 +78,7 @@ taketail(FILE *fp, const char *str, long n)
         ring = ecalloc(n, sizeof *ring);
         size = ecalloc(n, sizeof *size);
 
- for (i = j = 0; agetline(&ring[i], &size[i], fp) != -1; i = j = (i + 1) % n)
+ for (i = j = 0; getline(&ring[i], &size[i], fp) != -1; i = j = (i + 1) % n)
                 ;
         if (ferror(fp))
                 eprintf("%s: read error:", str);
diff --git a/text.h b/text.h
index f2e582e..a8117c9 100644
--- a/text.h
+++ b/text.h
_AT_@ -8,5 +8,4 @@ struct linebuf {
 #define EMPTY_LINEBUF {NULL, 0, 0,}
 void getlines(FILE *, struct linebuf *);
 
-ssize_t agetline(char **, size_t *, FILE *);
 void concat(FILE *, const char *, FILE *, const char *);
diff --git a/tr.c b/tr.c
index 19598d3..b661048 100644
--- a/tr.c
+++ b/tr.c
_AT_@ -346,7 +346,7 @@ main(int argc, char *argv[])
                 usage();
         }
 
- while ((nbytes = agetline(&buf, &size, stdin)) != -1)
+ while ((nbytes = getline(&buf, &size, stdin)) != -1)
                 mapfunc(buf, nbytes);
         free(buf);
         if (ferror(stdin))
diff --git a/uniq.c b/uniq.c
index 709a913..8600adb 100644
--- a/uniq.c
+++ b/uniq.c
_AT_@ -92,7 +92,7 @@ uniq(FILE *fp, const char *str)
         char *buf = NULL;
         size_t size = 0;
 
- while (agetline(&buf, &size, fp) != -1)
+ while (getline(&buf, &size, fp) != -1)
                 uniqline(buf);
 }
 
diff --git a/uudecode.c b/uudecode.c
index 09b5d63..833b24c 100644
--- a/uudecode.c
+++ b/uudecode.c
_AT_@ -128,7 +128,7 @@ uudecode(FILE *fp, FILE *outfp)
 #define IS_DEC(c) ( (((c) - ' ') >= 0) && (((c) - ' ') <= 077 + 1) )
 #define OUT_OF_RANGE(c) eprintf("character %c out of range: [%d-%d]", (c), 1 + ' ', 077 + ' ' + 1)
 
- while ((len = agetline(&bufb, &n, fp)) != -1) {
+ while ((len = getline(&bufb, &n, fp)) != -1) {
                 p = bufb;
                 /* trim newlines */
                 if (len && bufb[len - 1] != '\n')
_AT_@ -172,7 +172,7 @@ uudecode(FILE *fp, FILE *outfp)
                         eprintf("read error:");
         }
         /* check for end or fail */
- len = agetline(&bufb, &n, fp);
+ len = getline(&bufb, &n, fp);
         if (len < 3 || strncmp(bufb, "end", 3) != 0 || bufb[3] != '\n')
                 eprintf("invalid uudecode footer \"end\" not found\n");
         free(bufb);
Received on Tue Nov 18 2014 - 22:05:32 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 18 2014 - 22:12:20 CET