emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103166: Merge: * editfns.c: conform


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103166: Merge: * editfns.c: conform to C89 pointer rules
Date: Sun, 06 Feb 2011 18:51:50 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103166 [merge]
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2011-02-06 18:51:50 -0800
message:
  Merge: * editfns.c: conform to C89 pointer rules
modified:
  src/ChangeLog
  src/editfns.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-02-07 02:26:14 +0000
+++ b/src/ChangeLog     2011-02-07 02:51:10 +0000
@@ -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  <address@hidden>
 

=== modified file 'src/editfns.c'
--- a/src/editfns.c     2011-02-06 19:44:36 +0000
+++ b/src/editfns.c     2011-02-07 02:51:10 +0000
@@ -120,7 +120,7 @@
 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 @@
   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 @@
   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 @@
   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 @@
   (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 @@
   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 @@
              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 @@
 
                  /* 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 @@
   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 @@
      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 @@
      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 @@
       {
        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 @@
   /* 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 @@
   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 @@
        {
          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 @@
                  && !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 @@
                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 @@
       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 @@
     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.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]