Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
e9a3f858
Commit
e9a3f858
authored
8 years ago
by
Mike Frysinger
Committed by
Benno Schulenberg
8 years ago
Browse files
Options
Download
Email Patches
Plain Diff
drop the getdelim/getline fallback functions
Switch over to gnulib for these.
parent
28133e93
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
autogen.sh
+2
-0
autogen.sh
configure.ac
+1
-1
configure.ac
src/nano.h
+0
-6
src/nano.h
src/proto.h
+0
-8
src/proto.h
src/utils.c
+0
-87
src/utils.c
with
3 additions
and
102 deletions
+3
-102
autogen.sh
View file @
e9a3f858
...
...
@@ -5,6 +5,8 @@ gnulib_url="git://git.sv.gnu.org/gnulib.git"
gnulib_hash
=
"4084b3a1094372b960ce4a97634e08f4538c8bdd"
modules
=
"
getdelim
getline
strcase
strcasestr-simple
strnlen
...
...
This diff is collapsed.
Click to expand it.
configure.ac
View file @
e9a3f858
...
...
@@ -473,7 +473,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)
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
e9a3f858
...
...
@@ -137,12 +137,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. */
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
e9a3f858
...
...
@@ -652,14 +652,6 @@ void snuggly_fit(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
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
e9a3f858
...
...
@@ -170,93 +170,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. */
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help