minor utility tweaks

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2240 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-01-07 19:02:47 +00:00
parent 6d594a9cbb
commit 1307aae01a
3 changed files with 10 additions and 4 deletions

View File

@ -141,6 +141,13 @@ CVS code -
- Try to automatically detect whether UTF-8 support is needed by - Try to automatically detect whether UTF-8 support is needed by
setting the NO_UTF8 flag if setlocale() returns a string that setting the NO_UTF8 flag if setlocale() returns a string that
doesn't contain "UTF-8". (DLR) 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: - winio.c:
titlebar() titlebar()
- Rename some variables for consistency, make space an int - Rename some variables for consistency, make space an int

View File

@ -47,6 +47,7 @@
#define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char)) #define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char))
#ifdef BROKEN_REGEXEC #ifdef BROKEN_REGEXEC
#undef regexec
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags) #define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
#endif #endif

View File

@ -39,7 +39,6 @@
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
#ifdef BROKEN_REGEXEC #ifdef BROKEN_REGEXEC
#undef regexec
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch, int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags) 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 regexec(preg, string, nmatch, pmatch, eflags);
return REG_NOMATCH; return REG_NOMATCH;
} }
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags) #endif
#endif /* BROKEN_REGEXEC */
int regexp_bol_or_eol(const regex_t *preg, const char *string) 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(). */ /* This function is equivalent to isblank(). */
int is_blank_char(int c) int is_blank_char(int c)
{ {
return (c == '\t' || c == ' '); return isspace(c) && (!is_cntrl_char(c) || c == '\t');
} }
#endif #endif