diff options
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/editfns.c | 34 |
2 files changed, 19 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 69cfabaad3b..7901d65c086 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -7,6 +7,9 @@ | |||
| 7 | * editfns.c (init_editfns, Fuser_login_name, Fuser_uid): | 7 | * editfns.c (init_editfns, Fuser_login_name, Fuser_uid): |
| 8 | (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts, | 8 | (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts, |
| 9 | some of which prompt warnings from gcc -Wbad-function-cast. | 9 | some of which prompt warnings from gcc -Wbad-function-cast. |
| 10 | (Fformat_time_string, Fencode_time, Finsert_char): | ||
| 11 | (Ftranslate_region_internal, Fformat): | ||
| 12 | Rename or remove local vars to avoid shadowing. | ||
| 10 | 13 | ||
| 11 | 2011-03-15 Paul Eggert <eggert@cs.ucla.edu> | 14 | 2011-03-15 Paul Eggert <eggert@cs.ucla.edu> |
| 12 | 15 | ||
diff --git a/src/editfns.c b/src/editfns.c index 9966eaaa057..b02a92d5b98 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1721,7 +1721,7 @@ The modifiers are `E' and `O'. For certain characters X, | |||
| 1721 | %OX is like %X, but uses the locale's number symbols. | 1721 | %OX is like %X, but uses the locale's number symbols. |
| 1722 | 1722 | ||
| 1723 | For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) | 1723 | For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) |
| 1724 | (Lisp_Object format_string, Lisp_Object time, Lisp_Object universal) | 1724 | (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal) |
| 1725 | { | 1725 | { |
| 1726 | time_t value; | 1726 | time_t value; |
| 1727 | int size; | 1727 | int size; |
| @@ -1732,7 +1732,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) | |||
| 1732 | 1732 | ||
| 1733 | CHECK_STRING (format_string); | 1733 | CHECK_STRING (format_string); |
| 1734 | 1734 | ||
| 1735 | if (! (lisp_time_argument (time, &value, &usec) | 1735 | if (! (lisp_time_argument (timeval, &value, &usec) |
| 1736 | && 0 <= usec && usec < 1000000)) | 1736 | && 0 <= usec && usec < 1000000)) |
| 1737 | error ("Invalid time specification"); | 1737 | error ("Invalid time specification"); |
| 1738 | ns = usec * 1000; | 1738 | ns = usec * 1000; |
| @@ -1870,7 +1870,7 @@ year values as low as 1901 do work. | |||
| 1870 | usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | 1870 | usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) |
| 1871 | (int nargs, register Lisp_Object *args) | 1871 | (int nargs, register Lisp_Object *args) |
| 1872 | { | 1872 | { |
| 1873 | time_t time; | 1873 | time_t value; |
| 1874 | struct tm tm; | 1874 | struct tm tm; |
| 1875 | Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); | 1875 | Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); |
| 1876 | 1876 | ||
| @@ -1887,7 +1887,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1887 | if (NILP (zone)) | 1887 | if (NILP (zone)) |
| 1888 | { | 1888 | { |
| 1889 | BLOCK_INPUT; | 1889 | BLOCK_INPUT; |
| 1890 | time = mktime (&tm); | 1890 | value = mktime (&tm); |
| 1891 | UNBLOCK_INPUT; | 1891 | UNBLOCK_INPUT; |
| 1892 | } | 1892 | } |
| 1893 | else | 1893 | else |
| @@ -1915,7 +1915,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1915 | set_time_zone_rule (tzstring); | 1915 | set_time_zone_rule (tzstring); |
| 1916 | 1916 | ||
| 1917 | BLOCK_INPUT; | 1917 | BLOCK_INPUT; |
| 1918 | time = mktime (&tm); | 1918 | value = mktime (&tm); |
| 1919 | UNBLOCK_INPUT; | 1919 | UNBLOCK_INPUT; |
| 1920 | 1920 | ||
| 1921 | /* Restore TZ to previous value. */ | 1921 | /* Restore TZ to previous value. */ |
| @@ -1927,10 +1927,10 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1927 | #endif | 1927 | #endif |
| 1928 | } | 1928 | } |
| 1929 | 1929 | ||
| 1930 | if (time == (time_t) -1) | 1930 | if (value == (time_t) -1) |
| 1931 | time_overflow (); | 1931 | time_overflow (); |
| 1932 | 1932 | ||
| 1933 | return make_time (time); | 1933 | return make_time (value); |
| 1934 | } | 1934 | } |
| 1935 | 1935 | ||
| 1936 | DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 1, 0, | 1936 | DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 1, 0, |
| @@ -2340,7 +2340,7 @@ from adjoining text, if those properties are sticky. */) | |||
| 2340 | (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) | 2340 | (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) |
| 2341 | { | 2341 | { |
| 2342 | register char *string; | 2342 | register char *string; |
| 2343 | register EMACS_INT strlen; | 2343 | register EMACS_INT stringlen; |
| 2344 | register int i; | 2344 | register int i; |
| 2345 | register EMACS_INT n; | 2345 | register EMACS_INT n; |
| 2346 | int len; | 2346 | int len; |
| @@ -2358,18 +2358,18 @@ from adjoining text, if those properties are sticky. */) | |||
| 2358 | n = XINT (count) * len; | 2358 | n = XINT (count) * len; |
| 2359 | if (n <= 0) | 2359 | if (n <= 0) |
| 2360 | return Qnil; | 2360 | return Qnil; |
| 2361 | strlen = min (n, 256 * len); | 2361 | stringlen = min (n, 256 * len); |
| 2362 | string = (char *) alloca (strlen); | 2362 | string = (char *) alloca (stringlen); |
| 2363 | for (i = 0; i < strlen; i++) | 2363 | for (i = 0; i < stringlen; i++) |
| 2364 | string[i] = str[i % len]; | 2364 | string[i] = str[i % len]; |
| 2365 | while (n >= strlen) | 2365 | while (n >= stringlen) |
| 2366 | { | 2366 | { |
| 2367 | QUIT; | 2367 | QUIT; |
| 2368 | if (!NILP (inherit)) | 2368 | if (!NILP (inherit)) |
| 2369 | insert_and_inherit (string, strlen); | 2369 | insert_and_inherit (string, stringlen); |
| 2370 | else | 2370 | else |
| 2371 | insert (string, strlen); | 2371 | insert (string, stringlen); |
| 2372 | n -= strlen; | 2372 | n -= stringlen; |
| 2373 | } | 2373 | } |
| 2374 | if (n > 0) | 2374 | if (n > 0) |
| 2375 | { | 2375 | { |
| @@ -3029,7 +3029,6 @@ It returns the number of characters changed. */) | |||
| 3029 | EMACS_INT pos, pos_byte, end_pos; | 3029 | EMACS_INT pos, pos_byte, end_pos; |
| 3030 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 3030 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3031 | int string_multibyte; | 3031 | int string_multibyte; |
| 3032 | Lisp_Object val; | ||
| 3033 | 3032 | ||
| 3034 | validate_region (&start, &end); | 3033 | validate_region (&start, &end); |
| 3035 | if (CHAR_TABLE_P (table)) | 3034 | if (CHAR_TABLE_P (table)) |
| @@ -3928,7 +3927,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3928 | /* handle case (precision[n] >= 0) */ | 3927 | /* handle case (precision[n] >= 0) */ |
| 3929 | 3928 | ||
| 3930 | int width, padding; | 3929 | int width, padding; |
| 3931 | EMACS_INT nbytes, start, end; | 3930 | EMACS_INT nbytes, start; |
| 3932 | EMACS_INT nchars_string; | 3931 | EMACS_INT nchars_string; |
| 3933 | 3932 | ||
| 3934 | /* lisp_string_width ignores a precision of 0, but GNU | 3933 | /* lisp_string_width ignores a precision of 0, but GNU |
| @@ -3960,7 +3959,6 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3960 | 3959 | ||
| 3961 | info[n].start = start = nchars; | 3960 | info[n].start = start = nchars; |
| 3962 | nchars += nchars_string; | 3961 | nchars += nchars_string; |
| 3963 | end = nchars; | ||
| 3964 | 3962 | ||
| 3965 | if (p > buf | 3963 | if (p > buf |
| 3966 | && multibyte | 3964 | && multibyte |