diff options
| author | Richard M. Stallman | 1998-01-05 17:14:29 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-01-05 17:14:29 +0000 |
| commit | 82d6226f4e92fb6635ca19a6f4667340dadcdb0f (patch) | |
| tree | d541bf331f992f218c5a409e266c7e5c1c74a309 | |
| parent | af2b7cd5d652bb09d8d97208900cbfe8a7bbe41f (diff) | |
| download | emacs-82d6226f4e92fb6635ca19a6f4667340dadcdb0f.tar.gz emacs-82d6226f4e92fb6635ca19a6f4667340dadcdb0f.zip | |
(read_minibuf): Handle bytes vs chars
when checking for junk at end of expression.
| -rw-r--r-- | src/minibuf.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 583fc2ac7da..8d35b73de6f 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -470,12 +470,22 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 470 | { | 470 | { |
| 471 | Lisp_Object expr_and_pos; | 471 | Lisp_Object expr_and_pos; |
| 472 | unsigned char *p; | 472 | unsigned char *p; |
| 473 | int pos; | ||
| 473 | 474 | ||
| 474 | expr_and_pos = Fread_from_string (val, Qnil, Qnil); | 475 | expr_and_pos = Fread_from_string (val, Qnil, Qnil); |
| 475 | /* Ignore trailing whitespace; any other trailing junk is an error. */ | 476 | pos = XINT (Fcdr (expr_and_pos)); |
| 476 | for (p = XSTRING (val)->data + XINT (Fcdr (expr_and_pos)); *p; p++) | 477 | if (pos != XSTRING (val)->size) |
| 477 | if (*p != ' ' && *p != '\t' && *p != '\n') | 478 | { |
| 478 | error ("Trailing garbage following expression"); | 479 | /* Ignore trailing whitespace; any other trailing junk is an error. */ |
| 480 | int i; | ||
| 481 | pos = string_char_to_byte (val, pos); | ||
| 482 | for (i = pos; i < XSTRING (val)->size_byte; i++) | ||
| 483 | { | ||
| 484 | int c = XSTRING (val)->data[i]; | ||
| 485 | if (c != ' ' && c != '\t' && c != '\n') | ||
| 486 | error ("Trailing garbage following expression"); | ||
| 487 | } | ||
| 488 | } | ||
| 479 | val = Fcar (expr_and_pos); | 489 | val = Fcar (expr_and_pos); |
| 480 | } | 490 | } |
| 481 | 491 | ||