summaryrefslogtreecommitdiff
path: root/src/searchutils.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2014-02-19 19:22:24 -0800
committerJim Meyering <meyering@fb.com>2014-02-20 14:29:52 -0800
commit11ce80861109361570cbedda6a966264367f7c76 (patch)
tree6ce552e6767a95f3d891d2db3de899481dce27fc /src/searchutils.c
parent1179952ef0728c6f8cb65214fc8be2732c2d27a3 (diff)
downloadgrep-11ce80861109361570cbedda6a966264367f7c76.tar.gz
maint: give dfa.c's using_utf8 function external scope
* src/dfa.c (using_utf8): Remove "static inline". * src/dfa.h (using_utf8): Declare it. * src/searchutils.c (is_mb_middle): Use using_utf8 rather than rolling our own.
Diffstat (limited to 'src/searchutils.c')
-rw-r--r--src/searchutils.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/searchutils.c b/src/searchutils.c
index 34784178..73637019 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -19,6 +19,7 @@
#include <config.h>
#include <assert.h>
#include "search.h"
+#include "dfa.h"
#if HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
@@ -234,13 +235,8 @@ is_mb_middle (const char **good, const char *buf, const char *end,
const char *p = *good;
const char *prev = p;
mbstate_t cur_state;
-#if HAVE_LANGINFO_CODESET
- static int is_utf8 = -1;
-
- if (is_utf8 == -1)
- is_utf8 = STREQ (nl_langinfo (CODESET), "UTF-8");
- if (is_utf8 && buf - p > MB_CUR_MAX)
+ if (using_utf8 () && buf - p > MB_CUR_MAX)
{
for (p = buf; buf - p > MB_CUR_MAX; p--)
if (mbclen_cache[to_uchar (*p)] != (size_t) -1)
@@ -249,7 +245,6 @@ is_mb_middle (const char **good, const char *buf, const char *end,
if (buf - p == MB_CUR_MAX)
p = buf;
}
-#endif
memset (&cur_state, 0, sizeof cur_state);