# HG changeset patch # User Richard M. Stallman # Date 884020469 0 # Node ID 15deff6b28481a71283889caa0ee0b7c03d4f937 # Parent 24e567feaf18a6121e054e771d6ec92c5e60c36e (read_minibuf): Handle bytes vs chars when checking for junk at end of expression. diff -r 24e567feaf18 -r 15deff6b2848 src/minibuf.c --- a/src/minibuf.c Mon Jan 05 06:58:06 1998 +0000 +++ b/src/minibuf.c Mon Jan 05 17:14:29 1998 +0000 @@ -470,12 +470,22 @@ { Lisp_Object expr_and_pos; unsigned char *p; + int pos; expr_and_pos = Fread_from_string (val, Qnil, Qnil); - /* Ignore trailing whitespace; any other trailing junk is an error. */ - for (p = XSTRING (val)->data + XINT (Fcdr (expr_and_pos)); *p; p++) - if (*p != ' ' && *p != '\t' && *p != '\n') - error ("Trailing garbage following expression"); + pos = XINT (Fcdr (expr_and_pos)); + if (pos != XSTRING (val)->size) + { + /* 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); }