[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 05/10] drop getdelim/getline fallback functions
From: |
Mike Frysinger |
Subject: |
[Nano-devel] [PATCH 05/10] drop getdelim/getline fallback functions |
Date: |
Mon, 18 Apr 2016 02:17:40 -0400 |
Switch over to gnulib for these.
---
autogen.sh | 2 ++
configure.ac | 2 +-
src/nano.h | 6 -----
src/proto.h | 8 ------
src/utils.c | 87 ------------------------------------------------------------
5 files changed, 3 insertions(+), 102 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index 6e2d526..45c5bac 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -5,6 +5,8 @@ gnulib_url="git://git.sv.gnu.org/gnulib.git"
gnulib_hash="730c5249cc17a4ebb7afcb3f2f4e73664eeff5ce"
modules="
+ getdelim
+ getline
strcase
strcasestr-simple
strnlen
diff --git a/configure.ac b/configure.ac
index d0abbe5..069c0a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -432,7 +432,7 @@ int main(void)
dnl Checks for functions.
-AC_CHECK_FUNCS(getdelim getline isblank snprintf vsnprintf)
+AC_CHECK_FUNCS(isblank snprintf vsnprintf)
if test "x$enable_utf8" != xno; then
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen
mbstowcs mbtowc wctomb wcwidth)
diff --git a/src/nano.h b/src/nano.h
index 7c26ca2..4b2abe0 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -133,12 +133,6 @@
#ifndef HAVE_ISWBLANK
#define iswblank niswblank
#endif
-#ifndef HAVE_GETDELIM
-#define getdelim ngetdelim
-#endif
-#ifndef HAVE_GETLINE
-#define getline ngetline
-#endif
/* If we aren't using ncurses with mouse support, turn the mouse support
* off, as it's useless then. */
diff --git a/src/proto.h b/src/proto.h
index 42dfa91..b186927 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -695,14 +695,6 @@ void align(char **str);
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
-#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
-#ifndef HAVE_GETLINE
-ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
-#endif
-#ifndef HAVE_GETDELIM
-ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
-#endif
-#endif
#ifdef HAVE_REGEX_H
const char *fixbounds(const char *r);
#endif
diff --git a/src/utils.c b/src/utils.c
index 0814aa9..d515ab3 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -152,93 +152,6 @@ void sunder(char *str)
}
}
-/* These functions, ngetline() (originally getline()) and ngetdelim()
- * (originally getdelim()), were adapted from GNU mailutils 0.5
- * (mailbox/getline.c). Here is the notice from that file, after
- * converting to the GPL via LGPL clause 3, and with the Free Software
- * Foundation's address and the copyright years updated:
- *
- * GNU Mailutils -- a suite of utilities for electronic mail
- * Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007
- * Free Software Foundation, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 3 of the
- * License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301, USA. */
-
-#ifndef DISABLE_NANORC
-
-#ifndef HAVE_GETDELIM
-/* This function is equivalent to getdelim(). */
-ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
-{
- size_t indx = 0;
- int c;
-
- /* Sanity checks. */
- if (lineptr == NULL || n == NULL || stream == NULL ||
- fileno(stream) == -1) {
- errno = EINVAL;
- return -1;
- }
-
- /* Allocate the line the first time. */
- if (*lineptr == NULL) {
- *n = MAX_BUF_SIZE;
- *lineptr = charalloc(*n);
- }
-
- while ((c = getc(stream)) != EOF) {
- /* Check if more memory is needed. */
- if (indx >= *n) {
- *n += MAX_BUF_SIZE;
- *lineptr = charealloc(*lineptr, *n);
- }
-
- /* Put the result in the line. */
- (*lineptr)[indx++] = (char)c;
-
- /* Bail out. */
- if (c == delim)
- break;
- }
-
- /* Make room for the null character. */
- if (indx >= *n) {
- *n += MAX_BUF_SIZE;
- *lineptr = charealloc(*lineptr, *n);
- }
-
- /* Null-terminate the buffer. */
- null_at(lineptr, indx++);
- *n = indx;
-
- /* The last line may not have the delimiter. We have to return what
- * we got, and the error will be seen on the next iteration. */
- return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
-}
-#endif
-
-#ifndef HAVE_GETLINE
-/* This function is equivalent to getline(). */
-ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
-{
- return getdelim(lineptr, n, '\n', stream);
-}
-#endif
-#endif /* !DISABLE_NANORC */
-
#ifdef HAVE_REGEX_H
/* Fix the regex if we're on platforms which require an adjustment
* from GNU-style to BSD-style word boundaries. */
--
2.7.4
[Nano-devel] [PATCH 05/10] drop getdelim/getline fallback functions,
Mike Frysinger <=
[Nano-devel] [PATCH 09/10] drop glib fallback for snprintf/vsnprintf, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 06/10] drop isblank/iswblank fallback functions, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 10/10] drop wchar.h/wctype.h/stdarg.h checks, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 08/10] assume getopt_long support is always available, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 04/10] drop various str fallback functions, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 03/10] add support for gnulib, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 02/10] gettext: update to 0.18.3 release, Mike Frysinger, 2016/04/18