diff options
Diffstat (limited to 'src')
| -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 | ||