From: Paul Eggert Date: Mon, 7 Feb 2011 02:51:10 +0000 (-0800) Subject: * editfns.c: conform to C89 pointer rules X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~988 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e7f8264d90384314a258fee88b2c010ac53dcd81;p=emacs.git * editfns.c: conform to C89 pointer rules --- diff --git a/src/ChangeLog b/src/ChangeLog index 72a7bb926f7..9d2e9cb4a2f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -12,6 +12,9 @@ * data.c (Fstring_to_number): Likewise. * print.c (float_to_string, PRINTFINISH, printchar, strout): (print_object): Likewise. + * editfns.c (init_editfns, Fchar_to_string, Fbyte_to_string): + (Fuser_full_name, Fsubst_char_in_region, Ftranslate_region_internal): + (Fformat): Likewise. 2011-02-06 Paul Eggert 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 init_editfns (void) { char *user_name; - register unsigned char *p; + register char *p; struct passwd *pw; /* password entry for the current user */ Lisp_Object tem; @@ -165,7 +165,7 @@ init_editfns (void) Vuser_full_name = Fuser_full_name (NILP (tem)? make_number (geteuid()) : Vuser_login_name); - p = (unsigned char *) getenv ("NAME"); + p = getenv ("NAME"); if (p) Vuser_full_name = build_string (p); else if (NILP (Vuser_full_name)) @@ -193,7 +193,7 @@ usage: (char-to-string CHAR) */) CHECK_CHARACTER (character); len = CHAR_STRING (XFASTINT (character), str); - return make_string_from_bytes (str, 1, len); + return make_string_from_bytes ((char *) str, 1, len); } DEFUN ("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, if (XINT (byte) < 0 || XINT (byte) > 255) error ("Invalid byte"); b = XINT (byte); - return make_string_from_bytes (&b, 1, 1); + return make_string_from_bytes ((char *) &b, 1, 1); } DEFUN ("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. */) (Lisp_Object uid) { struct passwd *pw; - register unsigned char *p, *q; + register char *p, *q; Lisp_Object full; if (NILP (uid)) @@ -1352,26 +1352,26 @@ name, or nil if there is no such user. */) if (!pw) return Qnil; - p = (unsigned char *) USER_FULL_NAME; + p = USER_FULL_NAME; /* Chop off everything after the first comma. */ - q = (unsigned char *) strchr (p, ','); + q = strchr (p, ','); full = make_string (p, q ? q - p : strlen (p)); #ifdef AMPERSAND_FULL_NAME - p = SDATA (full); - q = (unsigned char *) strchr (p, '&'); + p = SSDATA (full); + q = strchr (p, '&'); /* Substitute the login name for the &, upcasing the first character. */ if (q) { - register unsigned char *r; + register char *r; Lisp_Object login; login = Fuser_login_name (make_number (pw->pw_uid)); - r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1); + r = (char *) alloca (strlen (p) + SCHARS (login) + 1); memcpy (r, p, q - p); r[q - p] = 0; strcat (r, SSDATA (login)); - r[q - p] = UPCASE (r[q - p]); + r[q - p] = UPCASE ((unsigned char) r[q - p]); strcat (r, q + 1); full = build_string (r); } @@ -2828,7 +2828,7 @@ Both characters must have the same length of multi-byte form. */) GCPRO1 (tem); /* Make a multibyte string containing this single character. */ - string = make_multibyte_string (tostr, 1, len); + string = make_multibyte_string ((char *) tostr, 1, len); /* replace_range is less efficient, because it moves the gap, but it handles combining correctly. */ replace_range (pos, pos + 1, string, @@ -3042,7 +3042,7 @@ It returns the number of characters changed. */) /* This is less efficient, because it moves the gap, but it should handle multibyte characters correctly. */ - string = make_multibyte_string (str, 1, str_len); + string = make_multibyte_string ((char *) str, 1, str_len); replace_range (pos, pos + 1, string, 1, 0, 1); len = str_len; } @@ -3511,7 +3511,7 @@ usage: (format STRING &rest OBJECTS) */) register int n; /* The number of the next arg to substitute */ register EMACS_INT total; /* An estimate of the final length */ char *buf, *p; - register unsigned char *format, *end, *format_start; + register char *format, *end, *format_start; int nchars; /* Nonzero if the output should be a multibyte string, which is true if any of the inputs is one. */ @@ -3521,7 +3521,7 @@ usage: (format STRING &rest OBJECTS) */) multibyte character of the previous string. This flag tells if we must consider such a situation or not. */ int maybe_combine_byte; - unsigned char *this_format; + char *this_format; /* Precision for each spec, or -1, a flag value meaning no precision was given in that spec. Element 0, corresonding to the format string itself, will not be used. Element NARGS, corresponding to @@ -3575,7 +3575,7 @@ usage: (format STRING &rest OBJECTS) */) That can only happen from the first large while loop below. */ retry: - format = SDATA (args[0]); + format = SSDATA (args[0]); format_start = format; end = format + SBYTES (args[0]); longest_format = 0; @@ -3605,7 +3605,7 @@ usage: (format STRING &rest OBJECTS) */) { EMACS_INT thissize = 0; EMACS_INT actual_width = 0; - unsigned char *this_format_start = format - 1; + char *this_format_start = format - 1; int field_width = 0; /* General format specifications look like @@ -3785,7 +3785,7 @@ usage: (format STRING &rest OBJECTS) */) /* Now we can no longer jump to retry. TOTAL and LONGEST_FORMAT are known for certain. */ - this_format = (unsigned char *) alloca (longest_format + 1); + this_format = (char *) alloca (longest_format + 1); /* Allocate the space for the result. Note that TOTAL is an overestimate. */ @@ -3796,7 +3796,7 @@ usage: (format STRING &rest OBJECTS) */) n = 0; /* Scan the format and store result in BUF. */ - format = SDATA (args[0]); + format = SSDATA (args[0]); format_start = format; end = format + SBYTES (args[0]); maybe_combine_byte = 0; @@ -3806,7 +3806,7 @@ usage: (format STRING &rest OBJECTS) */) { int minlen; int negative = 0; - unsigned char *this_format_start = format; + char *this_format_start = format; discarded[format - format_start] = 1; format++; @@ -3887,7 +3887,7 @@ usage: (format STRING &rest OBJECTS) */) && !CHAR_HEAD_P (SREF (args[n], 0))) maybe_combine_byte = 1; - p += copy_text (SDATA (args[n]), p, + p += copy_text (SDATA (args[n]), (unsigned char *) p, nbytes, STRING_MULTIBYTE (args[n]), multibyte); @@ -3955,7 +3955,8 @@ usage: (format STRING &rest OBJECTS) */) maybe_combine_byte = 1; this_nchars = strlen (p); if (multibyte) - p += str_to_multibyte (p, buf + total - 1 - p, this_nchars); + p += str_to_multibyte ((unsigned char *) p, + buf + total - 1 - p, this_nchars); else p += this_nchars; nchars += this_nchars; @@ -3982,7 +3983,8 @@ usage: (format STRING &rest OBJECTS) */) else if (multibyte) { /* Convert a single-byte character to multibyte. */ - int len = copy_text (format, p, 1, 0, 1); + int len = copy_text ((unsigned char *) format, (unsigned char *) p, + 1, 0, 1); p += len; format++; @@ -3996,7 +3998,7 @@ usage: (format STRING &rest OBJECTS) */) abort (); if (maybe_combine_byte) - nchars = multibyte_chars_in_text (buf, p - buf); + nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf); val = make_specified_string (buf, nchars, p - buf, multibyte); /* If we allocated BUF with malloc, free it too. */