aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-02-06 18:51:10 -0800
committerPaul Eggert2011-02-06 18:51:10 -0800
commite7f8264d90384314a258fee88b2c010ac53dcd81 (patch)
tree41efb541a96e2fe304b308650444ae4e2592f9be /src
parent09125ef8472d8b3d3b1ba762abc7feeb64b32911 (diff)
downloademacs-e7f8264d90384314a258fee88b2c010ac53dcd81.tar.gz
emacs-e7f8264d90384314a258fee88b2c010ac53dcd81.zip
* editfns.c: conform to C89 pointer rules
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/editfns.c52
2 files changed, 30 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 72a7bb926f7..9d2e9cb4a2f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -12,6 +12,9 @@
12 * data.c (Fstring_to_number): Likewise. 12 * data.c (Fstring_to_number): Likewise.
13 * print.c (float_to_string, PRINTFINISH, printchar, strout): 13 * print.c (float_to_string, PRINTFINISH, printchar, strout):
14 (print_object): Likewise. 14 (print_object): Likewise.
15 * editfns.c (init_editfns, Fchar_to_string, Fbyte_to_string):
16 (Fuser_full_name, Fsubst_char_in_region, Ftranslate_region_internal):
17 (Fformat): Likewise.
15 18
162011-02-06 Paul Eggert <eggert@cs.ucla.edu> 192011-02-06 Paul Eggert <eggert@cs.ucla.edu>
17 20
diff --git a/src/editfns.c b/src/editfns.c
index 3b14379be11..30acc36f025 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -120,7 +120,7 @@ void
120init_editfns (void) 120init_editfns (void)
121{ 121{
122 char *user_name; 122 char *user_name;
123 register unsigned char *p; 123 register char *p;
124 struct passwd *pw; /* password entry for the current user */ 124 struct passwd *pw; /* password entry for the current user */
125 Lisp_Object tem; 125 Lisp_Object tem;
126 126
@@ -165,7 +165,7 @@ init_editfns (void)
165 Vuser_full_name = Fuser_full_name (NILP (tem)? make_number (geteuid()) 165 Vuser_full_name = Fuser_full_name (NILP (tem)? make_number (geteuid())
166 : Vuser_login_name); 166 : Vuser_login_name);
167 167
168 p = (unsigned char *) getenv ("NAME"); 168 p = getenv ("NAME");
169 if (p) 169 if (p)
170 Vuser_full_name = build_string (p); 170 Vuser_full_name = build_string (p);
171 else if (NILP (Vuser_full_name)) 171 else if (NILP (Vuser_full_name))
@@ -193,7 +193,7 @@ usage: (char-to-string CHAR) */)
193 CHECK_CHARACTER (character); 193 CHECK_CHARACTER (character);
194 194
195 len = CHAR_STRING (XFASTINT (character), str); 195 len = CHAR_STRING (XFASTINT (character), str);
196 return make_string_from_bytes (str, 1, len); 196 return make_string_from_bytes ((char *) str, 1, len);
197} 197}
198 198
199DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, 199DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
@@ -205,7 +205,7 @@ DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
205 if (XINT (byte) < 0 || XINT (byte) > 255) 205 if (XINT (byte) < 0 || XINT (byte) > 255)
206 error ("Invalid byte"); 206 error ("Invalid byte");
207 b = XINT (byte); 207 b = XINT (byte);
208 return make_string_from_bytes (&b, 1, 1); 208 return make_string_from_bytes ((char *) &b, 1, 1);
209} 209}
210 210
211DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, 211DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,
@@ -1329,7 +1329,7 @@ name, or nil if there is no such user. */)
1329 (Lisp_Object uid) 1329 (Lisp_Object uid)
1330{ 1330{
1331 struct passwd *pw; 1331 struct passwd *pw;
1332 register unsigned char *p, *q; 1332 register char *p, *q;
1333 Lisp_Object full; 1333 Lisp_Object full;
1334 1334
1335 if (NILP (uid)) 1335 if (NILP (uid))
@@ -1352,26 +1352,26 @@ name, or nil if there is no such user. */)
1352 if (!pw) 1352 if (!pw)
1353 return Qnil; 1353 return Qnil;
1354 1354
1355 p = (unsigned char *) USER_FULL_NAME; 1355 p = USER_FULL_NAME;
1356 /* Chop off everything after the first comma. */ 1356 /* Chop off everything after the first comma. */
1357 q = (unsigned char *) strchr (p, ','); 1357 q = strchr (p, ',');
1358 full = make_string (p, q ? q - p : strlen (p)); 1358 full = make_string (p, q ? q - p : strlen (p));
1359 1359
1360#ifdef AMPERSAND_FULL_NAME 1360#ifdef AMPERSAND_FULL_NAME
1361 p = SDATA (full); 1361 p = SSDATA (full);
1362 q = (unsigned char *) strchr (p, '&'); 1362 q = strchr (p, '&');
1363 /* Substitute the login name for the &, upcasing the first character. */ 1363 /* Substitute the login name for the &, upcasing the first character. */
1364 if (q) 1364 if (q)
1365 { 1365 {
1366 register unsigned char *r; 1366 register char *r;
1367 Lisp_Object login; 1367 Lisp_Object login;
1368 1368
1369 login = Fuser_login_name (make_number (pw->pw_uid)); 1369 login = Fuser_login_name (make_number (pw->pw_uid));
1370 r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1); 1370 r = (char *) alloca (strlen (p) + SCHARS (login) + 1);
1371 memcpy (r, p, q - p); 1371 memcpy (r, p, q - p);
1372 r[q - p] = 0; 1372 r[q - p] = 0;
1373 strcat (r, SSDATA (login)); 1373 strcat (r, SSDATA (login));
1374 r[q - p] = UPCASE (r[q - p]); 1374 r[q - p] = UPCASE ((unsigned char) r[q - p]);
1375 strcat (r, q + 1); 1375 strcat (r, q + 1);
1376 full = build_string (r); 1376 full = build_string (r);
1377 } 1377 }
@@ -2828,7 +2828,7 @@ Both characters must have the same length of multi-byte form. */)
2828 GCPRO1 (tem); 2828 GCPRO1 (tem);
2829 2829
2830 /* Make a multibyte string containing this single character. */ 2830 /* Make a multibyte string containing this single character. */
2831 string = make_multibyte_string (tostr, 1, len); 2831 string = make_multibyte_string ((char *) tostr, 1, len);
2832 /* replace_range is less efficient, because it moves the gap, 2832 /* replace_range is less efficient, because it moves the gap,
2833 but it handles combining correctly. */ 2833 but it handles combining correctly. */
2834 replace_range (pos, pos + 1, string, 2834 replace_range (pos, pos + 1, string,
@@ -3042,7 +3042,7 @@ It returns the number of characters changed. */)
3042 3042
3043 /* This is less efficient, because it moves the gap, 3043 /* This is less efficient, because it moves the gap,
3044 but it should handle multibyte characters correctly. */ 3044 but it should handle multibyte characters correctly. */
3045 string = make_multibyte_string (str, 1, str_len); 3045 string = make_multibyte_string ((char *) str, 1, str_len);
3046 replace_range (pos, pos + 1, string, 1, 0, 1); 3046 replace_range (pos, pos + 1, string, 1, 0, 1);
3047 len = str_len; 3047 len = str_len;
3048 } 3048 }
@@ -3511,7 +3511,7 @@ usage: (format STRING &rest OBJECTS) */)
3511 register int n; /* The number of the next arg to substitute */ 3511 register int n; /* The number of the next arg to substitute */
3512 register EMACS_INT total; /* An estimate of the final length */ 3512 register EMACS_INT total; /* An estimate of the final length */
3513 char *buf, *p; 3513 char *buf, *p;
3514 register unsigned char *format, *end, *format_start; 3514 register char *format, *end, *format_start;
3515 int nchars; 3515 int nchars;
3516 /* Nonzero if the output should be a multibyte string, 3516 /* Nonzero if the output should be a multibyte string,
3517 which is true if any of the inputs is one. */ 3517 which is true if any of the inputs is one. */
@@ -3521,7 +3521,7 @@ usage: (format STRING &rest OBJECTS) */)
3521 multibyte character of the previous string. This flag tells if we 3521 multibyte character of the previous string. This flag tells if we
3522 must consider such a situation or not. */ 3522 must consider such a situation or not. */
3523 int maybe_combine_byte; 3523 int maybe_combine_byte;
3524 unsigned char *this_format; 3524 char *this_format;
3525 /* Precision for each spec, or -1, a flag value meaning no precision 3525 /* Precision for each spec, or -1, a flag value meaning no precision
3526 was given in that spec. Element 0, corresonding to the format 3526 was given in that spec. Element 0, corresonding to the format
3527 string itself, will not be used. Element NARGS, corresponding to 3527 string itself, will not be used. Element NARGS, corresponding to
@@ -3575,7 +3575,7 @@ usage: (format STRING &rest OBJECTS) */)
3575 That can only happen from the first large while loop below. */ 3575 That can only happen from the first large while loop below. */
3576 retry: 3576 retry:
3577 3577
3578 format = SDATA (args[0]); 3578 format = SSDATA (args[0]);
3579 format_start = format; 3579 format_start = format;
3580 end = format + SBYTES (args[0]); 3580 end = format + SBYTES (args[0]);
3581 longest_format = 0; 3581 longest_format = 0;
@@ -3605,7 +3605,7 @@ usage: (format STRING &rest OBJECTS) */)
3605 { 3605 {
3606 EMACS_INT thissize = 0; 3606 EMACS_INT thissize = 0;
3607 EMACS_INT actual_width = 0; 3607 EMACS_INT actual_width = 0;
3608 unsigned char *this_format_start = format - 1; 3608 char *this_format_start = format - 1;
3609 int field_width = 0; 3609 int field_width = 0;
3610 3610
3611 /* General format specifications look like 3611 /* General format specifications look like
@@ -3785,7 +3785,7 @@ usage: (format STRING &rest OBJECTS) */)
3785 /* Now we can no longer jump to retry. 3785 /* Now we can no longer jump to retry.
3786 TOTAL and LONGEST_FORMAT are known for certain. */ 3786 TOTAL and LONGEST_FORMAT are known for certain. */
3787 3787
3788 this_format = (unsigned char *) alloca (longest_format + 1); 3788 this_format = (char *) alloca (longest_format + 1);
3789 3789
3790 /* Allocate the space for the result. 3790 /* Allocate the space for the result.
3791 Note that TOTAL is an overestimate. */ 3791 Note that TOTAL is an overestimate. */
@@ -3796,7 +3796,7 @@ usage: (format STRING &rest OBJECTS) */)
3796 n = 0; 3796 n = 0;
3797 3797
3798 /* Scan the format and store result in BUF. */ 3798 /* Scan the format and store result in BUF. */
3799 format = SDATA (args[0]); 3799 format = SSDATA (args[0]);
3800 format_start = format; 3800 format_start = format;
3801 end = format + SBYTES (args[0]); 3801 end = format + SBYTES (args[0]);
3802 maybe_combine_byte = 0; 3802 maybe_combine_byte = 0;
@@ -3806,7 +3806,7 @@ usage: (format STRING &rest OBJECTS) */)
3806 { 3806 {
3807 int minlen; 3807 int minlen;
3808 int negative = 0; 3808 int negative = 0;
3809 unsigned char *this_format_start = format; 3809 char *this_format_start = format;
3810 3810
3811 discarded[format - format_start] = 1; 3811 discarded[format - format_start] = 1;
3812 format++; 3812 format++;
@@ -3887,7 +3887,7 @@ usage: (format STRING &rest OBJECTS) */)
3887 && !CHAR_HEAD_P (SREF (args[n], 0))) 3887 && !CHAR_HEAD_P (SREF (args[n], 0)))
3888 maybe_combine_byte = 1; 3888 maybe_combine_byte = 1;
3889 3889
3890 p += copy_text (SDATA (args[n]), p, 3890 p += copy_text (SDATA (args[n]), (unsigned char *) p,
3891 nbytes, 3891 nbytes,
3892 STRING_MULTIBYTE (args[n]), multibyte); 3892 STRING_MULTIBYTE (args[n]), multibyte);
3893 3893
@@ -3955,7 +3955,8 @@ usage: (format STRING &rest OBJECTS) */)
3955 maybe_combine_byte = 1; 3955 maybe_combine_byte = 1;
3956 this_nchars = strlen (p); 3956 this_nchars = strlen (p);
3957 if (multibyte) 3957 if (multibyte)
3958 p += str_to_multibyte (p, buf + total - 1 - p, this_nchars); 3958 p += str_to_multibyte ((unsigned char *) p,
3959 buf + total - 1 - p, this_nchars);
3959 else 3960 else
3960 p += this_nchars; 3961 p += this_nchars;
3961 nchars += this_nchars; 3962 nchars += this_nchars;
@@ -3982,7 +3983,8 @@ usage: (format STRING &rest OBJECTS) */)
3982 else if (multibyte) 3983 else if (multibyte)
3983 { 3984 {
3984 /* Convert a single-byte character to multibyte. */ 3985 /* Convert a single-byte character to multibyte. */
3985 int len = copy_text (format, p, 1, 0, 1); 3986 int len = copy_text ((unsigned char *) format, (unsigned char *) p,
3987 1, 0, 1);
3986 3988
3987 p += len; 3989 p += len;
3988 format++; 3990 format++;
@@ -3996,7 +3998,7 @@ usage: (format STRING &rest OBJECTS) */)
3996 abort (); 3998 abort ();
3997 3999
3998 if (maybe_combine_byte) 4000 if (maybe_combine_byte)
3999 nchars = multibyte_chars_in_text (buf, p - buf); 4001 nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf);
4000 val = make_specified_string (buf, nchars, p - buf, multibyte); 4002 val = make_specified_string (buf, nchars, p - buf, multibyte);
4001 4003
4002 /* If we allocated BUF with malloc, free it too. */ 4004 /* If we allocated BUF with malloc, free it too. */