nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 1307aae01a1f52f398a1abb93dbaa32153b5785d
parent 6d594a9cbbd385181304a93068c78e0fe303b56f
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Fri,  7 Jan 2005 19:02:47 +0000

minor utility tweaks


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2240 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 7+++++++
Msrc/nano.h | 1+
Msrc/utils.c | 6++----
3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -141,6 +141,13 @@ CVS code - - Try to automatically detect whether UTF-8 support is needed by setting the NO_UTF8 flag if setlocale() returns a string that doesn't contain "UTF-8". (DLR) +- utils.c: + regexec_safe() + - Remove redundant regexec #define, and move the regexec #undef + to nano.h. (DLR) + is_blank_char() + - Rewrite to use ctype functions instead of checking directly + for spaces and tabs. (DLR) - winio.c: titlebar() - Rename some variables for consistency, make space an int diff --git a/src/nano.h b/src/nano.h @@ -47,6 +47,7 @@ #define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char)) #ifdef BROKEN_REGEXEC +#undef regexec #define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags) #endif diff --git a/src/utils.c b/src/utils.c @@ -39,7 +39,6 @@ #ifdef HAVE_REGEX_H #ifdef BROKEN_REGEXEC -#undef regexec int regexec_safe(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) { @@ -47,8 +46,7 @@ int regexec_safe(const regex_t *preg, const char *string, size_t nmatch, return regexec(preg, string, nmatch, pmatch, eflags); return REG_NOMATCH; } -#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags) -#endif /* BROKEN_REGEXEC */ +#endif int regexp_bol_or_eol(const regex_t *preg, const char *string) { @@ -62,7 +60,7 @@ int regexp_bol_or_eol(const regex_t *preg, const char *string) /* This function is equivalent to isblank(). */ int is_blank_char(int c) { - return (c == '\t' || c == ' '); + return isspace(c) && (!is_cntrl_char(c) || c == '\t'); } #endif