diff options
| author | Paul Eggert | 2011-06-18 18:31:41 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-18 18:31:41 -0700 |
| commit | e4d29b3382b1a6f3b09e9d5d073493e909540593 (patch) | |
| tree | b954b8c59d8f50a9d720170f0d540f5091c7453c /src | |
| parent | cbeff735d291da31ca3c5ae61d2c5698b62b26e8 (diff) | |
| download | emacs-e4d29b3382b1a6f3b09e9d5d073493e909540593.tar.gz emacs-e4d29b3382b1a6f3b09e9d5d073493e909540593.zip | |
* lread.c (invalid_syntax): Omit length argument.
All uses changed. This doesn't fix a bug, but it simplifies the
code away from its former Hollerith-constant appearance, and it's
one less 'int' to worry about when looking at integer-overflow issues.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/lread.c | 34 |
2 files changed, 21 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 45fe3194744..2016669efc1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2011-06-19 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-06-19 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * lread.c (invalid_syntax): Omit length argument. | ||
| 4 | All uses changed. This doesn't fix a bug, but it simplifies the | ||
| 5 | code away from its former Hollerith-constant appearance, and it's | ||
| 6 | one less 'int' to worry about when looking at integer-overflow issues. | ||
| 7 | |||
| 3 | * lisp.h (DEFUN): Remove bogus use of sizeof (struct Lisp_Subr). | 8 | * lisp.h (DEFUN): Remove bogus use of sizeof (struct Lisp_Subr). |
| 4 | This didn't break anything, but it didn't help either. | 9 | This didn't break anything, but it didn't help either. |
| 5 | It's confusing to put a bogus integer in a place where the actual | 10 | It's confusing to put a bogus integer in a place where the actual |
diff --git a/src/lread.c b/src/lread.c index b789457b223..f8db6c14192 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -158,7 +158,7 @@ static void readevalloop (Lisp_Object, FILE*, Lisp_Object, int, | |||
| 158 | static Lisp_Object load_unwind (Lisp_Object); | 158 | static Lisp_Object load_unwind (Lisp_Object); |
| 159 | static Lisp_Object load_descriptor_unwind (Lisp_Object); | 159 | static Lisp_Object load_descriptor_unwind (Lisp_Object); |
| 160 | 160 | ||
| 161 | static void invalid_syntax (const char *, int) NO_RETURN; | 161 | static void invalid_syntax (const char *) NO_RETURN; |
| 162 | static void end_of_file_error (void) NO_RETURN; | 162 | static void end_of_file_error (void) NO_RETURN; |
| 163 | 163 | ||
| 164 | 164 | ||
| @@ -2014,11 +2014,9 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) | |||
| 2014 | S is error string of length N (if > 0) */ | 2014 | S is error string of length N (if > 0) */ |
| 2015 | 2015 | ||
| 2016 | static void | 2016 | static void |
| 2017 | invalid_syntax (const char *s, int n) | 2017 | invalid_syntax (const char *s) |
| 2018 | { | 2018 | { |
| 2019 | if (!n) | 2019 | xsignal1 (Qinvalid_read_syntax, build_string (s)); |
| 2020 | n = strlen (s); | ||
| 2021 | xsignal1 (Qinvalid_read_syntax, make_string (s, n)); | ||
| 2022 | } | 2020 | } |
| 2023 | 2021 | ||
| 2024 | 2022 | ||
| @@ -2336,7 +2334,7 @@ read_integer (Lisp_Object readcharfun, int radix) | |||
| 2336 | if (! valid) | 2334 | if (! valid) |
| 2337 | { | 2335 | { |
| 2338 | sprintf (buf, "integer, radix %d", radix); | 2336 | sprintf (buf, "integer, radix %d", radix); |
| 2339 | invalid_syntax (buf, 0); | 2337 | invalid_syntax (buf); |
| 2340 | } | 2338 | } |
| 2341 | 2339 | ||
| 2342 | return string_to_number (buf, radix, 0); | 2340 | return string_to_number (buf, radix, 0); |
| @@ -2453,7 +2451,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2453 | return ht; | 2451 | return ht; |
| 2454 | } | 2452 | } |
| 2455 | UNREAD (c); | 2453 | UNREAD (c); |
| 2456 | invalid_syntax ("#", 1); | 2454 | invalid_syntax ("#"); |
| 2457 | } | 2455 | } |
| 2458 | if (c == '^') | 2456 | if (c == '^') |
| 2459 | { | 2457 | { |
| @@ -2487,9 +2485,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2487 | XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE); | 2485 | XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE); |
| 2488 | return tmp; | 2486 | return tmp; |
| 2489 | } | 2487 | } |
| 2490 | invalid_syntax ("#^^", 3); | 2488 | invalid_syntax ("#^^"); |
| 2491 | } | 2489 | } |
| 2492 | invalid_syntax ("#^", 2); | 2490 | invalid_syntax ("#^"); |
| 2493 | } | 2491 | } |
| 2494 | if (c == '&') | 2492 | if (c == '&') |
| 2495 | { | 2493 | { |
| @@ -2513,7 +2511,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2513 | version. */ | 2511 | version. */ |
| 2514 | && ! (XFASTINT (length) | 2512 | && ! (XFASTINT (length) |
| 2515 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) | 2513 | == (SCHARS (tmp) - 1) * BOOL_VECTOR_BITS_PER_CHAR))) |
| 2516 | invalid_syntax ("#&...", 5); | 2514 | invalid_syntax ("#&..."); |
| 2517 | 2515 | ||
| 2518 | val = Fmake_bool_vector (length, Qnil); | 2516 | val = Fmake_bool_vector (length, Qnil); |
| 2519 | memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars); | 2517 | memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars); |
| @@ -2523,7 +2521,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2523 | &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; | 2521 | &= (1 << (XINT (length) % BOOL_VECTOR_BITS_PER_CHAR)) - 1; |
| 2524 | return val; | 2522 | return val; |
| 2525 | } | 2523 | } |
| 2526 | invalid_syntax ("#&...", 5); | 2524 | invalid_syntax ("#&..."); |
| 2527 | } | 2525 | } |
| 2528 | if (c == '[') | 2526 | if (c == '[') |
| 2529 | { | 2527 | { |
| @@ -2543,7 +2541,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2543 | /* Read the string itself. */ | 2541 | /* Read the string itself. */ |
| 2544 | tmp = read1 (readcharfun, &ch, 0); | 2542 | tmp = read1 (readcharfun, &ch, 0); |
| 2545 | if (ch != 0 || !STRINGP (tmp)) | 2543 | if (ch != 0 || !STRINGP (tmp)) |
| 2546 | invalid_syntax ("#", 1); | 2544 | invalid_syntax ("#"); |
| 2547 | GCPRO1 (tmp); | 2545 | GCPRO1 (tmp); |
| 2548 | /* Read the intervals and their properties. */ | 2546 | /* Read the intervals and their properties. */ |
| 2549 | while (1) | 2547 | while (1) |
| @@ -2559,7 +2557,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2559 | if (ch == 0) | 2557 | if (ch == 0) |
| 2560 | plist = read1 (readcharfun, &ch, 0); | 2558 | plist = read1 (readcharfun, &ch, 0); |
| 2561 | if (ch) | 2559 | if (ch) |
| 2562 | invalid_syntax ("Invalid string property list", 0); | 2560 | invalid_syntax ("Invalid string property list"); |
| 2563 | Fset_text_properties (beg, end, plist, tmp); | 2561 | Fset_text_properties (beg, end, plist, tmp); |
| 2564 | } | 2562 | } |
| 2565 | UNGCPRO; | 2563 | UNGCPRO; |
| @@ -2716,7 +2714,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2716 | return read_integer (readcharfun, 2); | 2714 | return read_integer (readcharfun, 2); |
| 2717 | 2715 | ||
| 2718 | UNREAD (c); | 2716 | UNREAD (c); |
| 2719 | invalid_syntax ("#", 1); | 2717 | invalid_syntax ("#"); |
| 2720 | 2718 | ||
| 2721 | case ';': | 2719 | case ';': |
| 2722 | while ((c = READCHAR) >= 0 && c != '\n'); | 2720 | while ((c = READCHAR) >= 0 && c != '\n'); |
| @@ -2833,7 +2831,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2833 | if (ok) | 2831 | if (ok) |
| 2834 | return make_number (c); | 2832 | return make_number (c); |
| 2835 | 2833 | ||
| 2836 | invalid_syntax ("?", 1); | 2834 | invalid_syntax ("?"); |
| 2837 | } | 2835 | } |
| 2838 | 2836 | ||
| 2839 | case '"': | 2837 | case '"': |
| @@ -3501,7 +3499,7 @@ read_list (int flag, register Lisp_Object readcharfun) | |||
| 3501 | { | 3499 | { |
| 3502 | if (ch == ']') | 3500 | if (ch == ']') |
| 3503 | return val; | 3501 | return val; |
| 3504 | invalid_syntax (") or . in a vector", 18); | 3502 | invalid_syntax (") or . in a vector"); |
| 3505 | } | 3503 | } |
| 3506 | if (ch == ')') | 3504 | if (ch == ')') |
| 3507 | return val; | 3505 | return val; |
| @@ -3603,9 +3601,9 @@ read_list (int flag, register Lisp_Object readcharfun) | |||
| 3603 | 3601 | ||
| 3604 | return val; | 3602 | return val; |
| 3605 | } | 3603 | } |
| 3606 | invalid_syntax (". in wrong context", 18); | 3604 | invalid_syntax (". in wrong context"); |
| 3607 | } | 3605 | } |
| 3608 | invalid_syntax ("] in a list", 11); | 3606 | invalid_syntax ("] in a list"); |
| 3609 | } | 3607 | } |
| 3610 | tem = (read_pure && flag <= 0 | 3608 | tem = (read_pure && flag <= 0 |
| 3611 | ? pure_cons (elt, Qnil) | 3609 | ? pure_cons (elt, Qnil) |