* src/coding.c (string_ascii_p): Make it non-static.
* src/fileio.c (Fdirectory_append): Fix check for whether we need
to convert to multibyte.
* src/fns.c (string_ascii_p): Remove copy.
* src/lisp.h: Declare string_ascii_p.
}
/* Whether STRING only contains chars in the 0..127 range. */
-static bool
+bool
string_ascii_p (Lisp_Object string)
{
ptrdiff_t nbytes = SBYTES (string);
{
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),
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
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);