Commit 82d6226f authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(read_minibuf): Handle bytes vs chars

when checking for junk at end of expression.
parent af2b7cd5
...@@ -470,12 +470,22 @@ read_minibuf (map, initial, prompt, backup_n, expflag, ...@@ -470,12 +470,22 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
{ {
Lisp_Object expr_and_pos; Lisp_Object expr_and_pos;
unsigned char *p; unsigned char *p;
int pos;
expr_and_pos = Fread_from_string (val, Qnil, Qnil); expr_and_pos = Fread_from_string (val, Qnil, Qnil);
/* Ignore trailing whitespace; any other trailing junk is an error. */ pos = XINT (Fcdr (expr_and_pos));
for (p = XSTRING (val)->data + XINT (Fcdr (expr_and_pos)); *p; p++) if (pos != XSTRING (val)->size)
if (*p != ' ' && *p != '\t' && *p != '\n') {
error ("Trailing garbage following expression"); /* Ignore trailing whitespace; any other trailing junk is an error. */
int i;
pos = string_char_to_byte (val, pos);
for (i = pos; i < XSTRING (val)->size_byte; i++)
{
int c = XSTRING (val)->data[i];
if (c != ' ' && c != '\t' && c != '\n')
error ("Trailing garbage following expression");
}
}
val = Fcar (expr_and_pos); val = Fcar (expr_and_pos);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment