summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/coding.c2
-rw-r--r--src/fileio.c2
-rw-r--r--src/fns.c10
-rw-r--r--src/lisp.h1
4 files changed, 3 insertions, 12 deletions
diff --git a/src/coding.c b/src/coding.c
index 46e7fca0f43..87b55aecc05 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -9476,7 +9476,7 @@ not fully specified.) */)
}
/* Whether STRING only contains chars in the 0..127 range. */
-static bool
+bool
string_ascii_p (Lisp_Object string)
{
ptrdiff_t nbytes = SBYTES (string);
diff --git a/src/fileio.c b/src/fileio.c
index 643fc361689..60f5650302c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -796,7 +796,7 @@ usage: (record DIRECTORY &rest COMPONENTS) */)
{
Lisp_Object arg = args[i];
/* Use multibyte or all-ASCII strings as is. */
- if (STRING_MULTIBYTE (arg) || SCHARS (arg) == SBYTES (arg))
+ if (STRING_MULTIBYTE (arg) || string_ascii_p (arg))
elements[i] = arg;
else
elements[i] = make_multibyte_string (SSDATA (arg), SCHARS (arg),
diff --git a/src/fns.c b/src/fns.c
index 7b9e3b0f7fc..932800a3a49 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5769,16 +5769,6 @@ characters. */ )
return list3 (make_int (lines), make_int (longest), make_float (mean));
}
-static bool
-string_ascii_p (Lisp_Object string)
-{
- ptrdiff_t nbytes = SBYTES (string);
- for (ptrdiff_t i = 0; i < nbytes; i++)
- if (SREF (string, i) > 127)
- return false;
- return true;
-}
-
DEFUN ("string-search", Fstring_search, Sstring_search, 2, 3, 0,
doc: /* Search for the string NEEDLE in the string HAYSTACK.
The return value is the position of the first occurrence of NEEDLE in
diff --git a/src/lisp.h b/src/lisp.h
index 80efd771139..15a42a44562 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3586,6 +3586,7 @@ extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t,
extern void init_coding (void);
extern void init_coding_once (void);
extern void syms_of_coding (void);
+extern bool string_ascii_p (Lisp_Object);
/* Defined in character.c. */
extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t);