aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-06-24 12:17:32 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-07-06 08:10:55 +0200
commitcbac0245c8fd94ce66c05b1abe05bfa0d6dda251 (patch)
treee6e3e4f953d53b6991dc53c1bac5b38950036593
parentcf83df45744763e2802db73002b9031fa9b5e235 (diff)
downloadpasst-cbac0245c8fd94ce66c05b1abe05bfa0d6dda251.tar
passt-cbac0245c8fd94ce66c05b1abe05bfa0d6dda251.tar.gz
passt-cbac0245c8fd94ce66c05b1abe05bfa0d6dda251.tar.bz2
passt-cbac0245c8fd94ce66c05b1abe05bfa0d6dda251.tar.lz
passt-cbac0245c8fd94ce66c05b1abe05bfa0d6dda251.tar.xz
passt-cbac0245c8fd94ce66c05b1abe05bfa0d6dda251.tar.zst
passt-cbac0245c8fd94ce66c05b1abe05bfa0d6dda251.zip
Remove unused line_read()
The old, ugly implementation of line_read() is no longer used. Remove it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--util.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/util.c b/util.c
index 83729d2..98946e4 100644
--- a/util.c
+++ b/util.c
@@ -410,60 +410,6 @@ int bitmap_isset(const uint8_t *map, int bit)
}
/**
- * line_read() - Similar to fgets(), no heap usage, a file instead of a stream
- * @buf: Read buffer: on non-empty string, use that instead of reading
- * @len: Maximum line length
- * @fd: File descriptor for reading
- *
- * Return: @buf if a line is found, NULL on EOF or error
- */
-char *line_read(char *buf, size_t len, int fd)
-{
- int n, do_read = !*buf;
- char *p;
-
- if (!do_read) {
- char *nl;
-
- buf[len - 1] = 0;
- if (!strlen(buf))
- return NULL;
-
- p = buf + strlen(buf) + 1;
-
- while (*p == '\n' && strlen(p) && (size_t)(p - buf) < len)
- p++;
-
- if (!(nl = strchr(p, '\n')))
- return NULL;
- *nl = 0;
-
- return memmove(buf, p, len - (p - buf));
- }
-
- n = read(fd, buf, --len);
- if (n <= 0)
- return NULL;
-
- buf[len] = 0;
-
- p = buf;
- while (*p == '\n' && strlen(p) && (size_t)(p - buf) < len)
- p++;
-
- if (!(p = strchr(p, '\n')))
- return buf;
-
- *p = 0;
- if (p == buf)
- return buf;
-
- lseek(fd, (p - buf) - n + 1, SEEK_CUR);
-
- return buf;
-}
-
-/**
* procfs_scan_listen() - Set bits for listening TCP or UDP sockets from procfs
* @proto: IPPROTO_TCP or IPPROTO_UDP
* @ip_version: IP version, V4 or V6