emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/editfns.c


From: Ken Raeburn
Subject: [Emacs-diffs] Changes to emacs/src/editfns.c
Date: Sun, 14 Jul 2002 20:00:48 -0400

Index: emacs/src/editfns.c
diff -c emacs/src/editfns.c:1.331 emacs/src/editfns.c:1.332
*** emacs/src/editfns.c:1.331   Thu Jul 11 10:10:34 2002
--- emacs/src/editfns.c Sun Jul 14 20:00:36 2002
***************
*** 1202,1208 ****
    else if (NUMBERP (uid))
      pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid));
    else if (STRINGP (uid))
!     pw = (struct passwd *) getpwnam (XSTRING (uid)->data);
    else
      error ("Invalid UID specification");
  
--- 1202,1208 ----
    else if (NUMBERP (uid))
      pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid));
    else if (STRINGP (uid))
!     pw = (struct passwd *) getpwnam (SDATA (uid));
    else
      error ("Invalid UID specification");
  
***************
*** 1215,1221 ****
    full = make_string (p, q ? q - p : strlen (p));
  
  #ifdef AMPERSAND_FULL_NAME
!   p = XSTRING (full)->data;
    q = (unsigned char *) index (p, '&');
    /* Substitute the login name for the &, upcasing the first character.  */
    if (q)
--- 1215,1221 ----
    full = make_string (p, q ? q - p : strlen (p));
  
  #ifdef AMPERSAND_FULL_NAME
!   p = SDATA (full);
    q = (unsigned char *) index (p, '&');
    /* Substitute the login name for the &, upcasing the first character.  */
    if (q)
***************
*** 1224,1233 ****
        Lisp_Object login;
  
        login = Fuser_login_name (make_number (pw->pw_uid));
!       r = (unsigned char *) alloca (strlen (p) + XSTRING (login)->size + 1);
        bcopy (p, r, q - p);
        r[q - p] = 0;
!       strcat (r, XSTRING (login)->data);
        r[q - p] = UPCASE (r[q - p]);
        strcat (r, q + 1);
        full = build_string (r);
--- 1224,1233 ----
        Lisp_Object login;
  
        login = Fuser_login_name (make_number (pw->pw_uid));
!       r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1);
        bcopy (p, r, q - p);
        r[q - p] = 0;
!       strcat (r, SDATA (login));
        r[q - p] = UPCASE (r[q - p]);
        strcat (r, q + 1);
        full = build_string (r);
***************
*** 1250,1256 ****
  get_system_name ()
  {
    if (STRINGP (Vsystem_name))
!     return (char *) XSTRING (Vsystem_name)->data;
    else
      return "";
  }
--- 1250,1256 ----
  get_system_name ()
  {
    if (STRINGP (Vsystem_name))
!     return (char *) SDATA (Vsystem_name);
    else
      return "";
  }
***************
*** 1479,1485 ****
                                                Vlocale_coding_system, 1);
  
    /* This is probably enough.  */
!   size = STRING_BYTES (XSTRING (format_string)) * 6 + 50;
  
    tm = ut ? gmtime (&value) : localtime (&value);
    if (! tm)
--- 1479,1485 ----
                                                Vlocale_coding_system, 1);
  
    /* This is probably enough.  */
!   size = SBYTES (format_string) * 6 + 50;
  
    tm = ut ? gmtime (&value) : localtime (&value);
    if (! tm)
***************
*** 1493,1500 ****
        int result;
  
        buf[0] = '\1';
!       result = emacs_memftimeu (buf, size, XSTRING (format_string)->data,
!                               STRING_BYTES (XSTRING (format_string)),
                                tm, ut);
        if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
        return code_convert_string_norecord (make_string (buf, result),
--- 1493,1500 ----
        int result;
  
        buf[0] = '\1';
!       result = emacs_memftimeu (buf, size, SDATA (format_string),
!                               SBYTES (format_string),
                                tm, ut);
        if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
        return code_convert_string_norecord (make_string (buf, result),
***************
*** 1502,1509 ****
  
        /* If buffer was too small, make it bigger and try again.  */
        result = emacs_memftimeu (NULL, (size_t) -1,
!                               XSTRING (format_string)->data,
!                               STRING_BYTES (XSTRING (format_string)),
                                tm, ut);
        size = result + 1;
      }
--- 1502,1509 ----
  
        /* If buffer was too small, make it bigger and try again.  */
        result = emacs_memftimeu (NULL, (size_t) -1,
!                               SDATA (format_string),
!                               SBYTES (format_string),
                                tm, ut);
        size = result + 1;
      }
***************
*** 1610,1616 ****
        if (EQ (zone, Qt))
        tzstring = "UTC0";
        else if (STRINGP (zone))
!       tzstring = (char *) XSTRING (zone)->data;
        else if (INTEGERP (zone))
        {
          int abszone = abs (XINT (zone));
--- 1610,1616 ----
        if (EQ (zone, Qt))
        tzstring = "UTC0";
        else if (STRINGP (zone))
!       tzstring = (char *) SDATA (zone);
        else if (INTEGERP (zone))
        {
          int abszone = abs (XINT (zone));
***************
*** 1788,1794 ****
    else
      {
        CHECK_STRING (tz);
!       tzstring = (char *) XSTRING (tz)->data;
      }
  
    set_time_zone_rule (tzstring);
--- 1788,1794 ----
    else
      {
        CHECK_STRING (tz);
!       tzstring = (char *) SDATA (tz);
      }
  
    set_time_zone_rule (tzstring);
***************
*** 1934,1941 ****
        else if (STRINGP (val))
        {
          (*insert_from_string_func) (val, 0, 0,
!                                     XSTRING (val)->size,
!                                     STRING_BYTES (XSTRING (val)),
                                      inherit);
        }
        else
--- 1934,1941 ----
        else if (STRINGP (val))
        {
          (*insert_from_string_func) (val, 0, 0,
!                                     SCHARS (val),
!                                     SBYTES (val),
                                      inherit);
        }
        else
***************
*** 2146,2152 ****
      result = make_uninit_multibyte_string (end - start, end_byte - 
start_byte);
    else
      result = make_uninit_string (end - start);
!   bcopy (BYTE_POS_ADDR (start_byte), XSTRING (result)->data,
         end_byte - start_byte);
  
    /* If desired, update and copy the text properties.  */
--- 2146,2152 ----
      result = make_uninit_multibyte_string (end - start, end_byte - 
start_byte);
    else
      result = make_uninit_string (end - start);
!   bcopy (BYTE_POS_ADDR (start_byte), SDATA (result),
         end_byte - start_byte);
  
    /* If desired, update and copy the text properties.  */
***************
*** 2659,2666 ****
    validate_region (&start, &end);
    CHECK_STRING (table);
  
!   size = STRING_BYTES (XSTRING (table));
!   tt = XSTRING (table)->data;
  
    pos_byte = CHAR_TO_BYTE (XINT (start));
    stop = CHAR_TO_BYTE (XINT (end));
--- 2659,2666 ----
    validate_region (&start, &end);
    CHECK_STRING (table);
  
!   size = SBYTES (table);
!   tt = SDATA (table);
  
    pos_byte = CHAR_TO_BYTE (XINT (start));
    stop = CHAR_TO_BYTE (XINT (end));
***************
*** 2929,2935 ****
      {
        register Lisp_Object val;
        val = Fformat (nargs, args);
!       message3 (val, STRING_BYTES (XSTRING (val)), STRING_MULTIBYTE (val));
        return val;
      }
  }
--- 2929,2935 ----
      {
        register Lisp_Object val;
        val = Fformat (nargs, args);
!       message3 (val, SBYTES (val), STRING_MULTIBYTE (val));
        return val;
      }
  }
***************
*** 2979,2991 ****
          message_text = (char *)xmalloc (80);
          message_length = 80;
        }
!       if (STRING_BYTES (XSTRING (val)) > message_length)
        {
!         message_length = STRING_BYTES (XSTRING (val));
          message_text = (char *)xrealloc (message_text, message_length);
        }
!       bcopy (XSTRING (val)->data, message_text, STRING_BYTES (XSTRING (val)));
!       message2 (message_text, STRING_BYTES (XSTRING (val)),
                STRING_MULTIBYTE (val));
        return val;
      }
--- 2979,2991 ----
          message_text = (char *)xmalloc (80);
          message_length = 80;
        }
!       if (SBYTES (val) > message_length)
        {
!         message_length = SBYTES (val);
          message_text = (char *)xrealloc (message_text, message_length);
        }
!       bcopy (SDATA (val), message_text, SBYTES (val));
!       message2 (message_text, SBYTES (val),
                STRING_MULTIBYTE (val));
        return val;
      }
***************
*** 3058,3064 ****
      }
  
    Fadd_text_properties (make_number (0),
!                       make_number (XSTRING (string)->size),
                        properties, string);
    RETURN_UNGCPRO (string);
  }
--- 3058,3064 ----
      }
  
    Fadd_text_properties (make_number (0),
!                       make_number (SCHARS (string)),
                        properties, string);
    RETURN_UNGCPRO (string);
  }
***************
*** 3069,3077 ****
  
  #define CONVERTED_BYTE_SIZE(MULTIBYTE, STRING)                                
\
    (((MULTIBYTE) && ! STRING_MULTIBYTE (STRING))                               
\
!    ? count_size_as_multibyte (XSTRING (STRING)->data,                 \
!                             STRING_BYTES (XSTRING (STRING)))          \
!    : STRING_BYTES (XSTRING (STRING)))
  
  DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
         doc: /* Format a string out of a control-string and arguments.
--- 3069,3076 ----
  
  #define CONVERTED_BYTE_SIZE(MULTIBYTE, STRING)                                
\
    (((MULTIBYTE) && ! STRING_MULTIBYTE (STRING))                               
\
!    ? count_size_as_multibyte (SDATA (STRING), SBYTES (STRING))                
\
!    : SBYTES (STRING))
  
  DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
         doc: /* Format a string out of a control-string and arguments.
***************
*** 3133,3140 ****
       and later find it has to be multibyte, we jump back to retry.  */
   retry:
  
!   format = XSTRING (args[0])->data;
!   end = format + STRING_BYTES (XSTRING (args[0]));
    longest_format = 0;
  
    /* Make room in result for all the non-%-codes in the control string.  */
--- 3132,3139 ----
       and later find it has to be multibyte, we jump back to retry.  */
   retry:
  
!   format = SDATA (args[0]);
!   end = format + SBYTES (args[0]);
    longest_format = 0;
  
    /* Make room in result for all the non-%-codes in the control string.  */
***************
*** 3255,3261 ****
                    goto retry;
                  }
                args[n] = Fchar_to_string (args[n]);
!               thissize = STRING_BYTES (XSTRING (args[n]));
              }
          }
        else if (FLOATP (args[n]) && *format != 's')
--- 3254,3260 ----
                    goto retry;
                  }
                args[n] = Fchar_to_string (args[n]);
!               thissize = SBYTES (args[n]);
              }
          }
        else if (FLOATP (args[n]) && *format != 's')
***************
*** 3303,3309 ****
    n = 0;
  
    /* Scan the format and store result in BUF.  */
!   format = XSTRING (args[0])->data;
    maybe_combine_byte = 0;
    while (format != end)
      {
--- 3302,3308 ----
    n = 0;
  
    /* Scan the format and store result in BUF.  */
!   format = SDATA (args[0]);
    maybe_combine_byte = 0;
    while (format != end)
      {
***************
*** 3353,3365 ****
                  && multibyte
                  && !ASCII_BYTE_P (*((unsigned char *) p - 1))
                  && STRING_MULTIBYTE (args[n])
!                 && !CHAR_HEAD_P (XSTRING (args[n])->data[0]))
                maybe_combine_byte = 1;
!             nbytes = copy_text (XSTRING (args[n])->data, p,
!                                 STRING_BYTES (XSTRING (args[n])),
                                  STRING_MULTIBYTE (args[n]), multibyte);
              p += nbytes;
!             nchars += XSTRING (args[n])->size;
              end = nchars;
  
              if (negative)
--- 3352,3364 ----
                  && multibyte
                  && !ASCII_BYTE_P (*((unsigned char *) p - 1))
                  && STRING_MULTIBYTE (args[n])
!                 && !CHAR_HEAD_P (SREF (args[n], 0)))
                maybe_combine_byte = 1;
!             nbytes = copy_text (SDATA (args[n]), p,
!                                 SBYTES (args[n]),
                                  STRING_MULTIBYTE (args[n]), multibyte);
              p += nbytes;
!             nchars += SCHARS (args[n]);
              end = nchars;
  
              if (negative)
***************
*** 3371,3377 ****
  
              /* If this argument has text properties, record where
                 in the result string it appears.  */
!             if (XSTRING (args[n])->intervals)
                {
                  if (!info)
                    {
--- 3370,3376 ----
  
              /* If this argument has text properties, record where
                 in the result string it appears.  */
!             if (STRING_INTERVALS (args[n]))
                {
                  if (!info)
                    {
***************
*** 3450,3468 ****
       arguments has text properties, set up text properties of the
       result string.  */
  
!   if (XSTRING (args[0])->intervals || info)
      {
        Lisp_Object len, new_len, props;
        struct gcpro gcpro1;
  
        /* Add text properties from the format string.  */
!       len = make_number (XSTRING (args[0])->size);
        props = text_property_list (args[0], make_number (0), len, Qnil);
        GCPRO1 (props);
  
        if (CONSP (props))
        {
!         new_len = make_number (XSTRING (val)->size);
          extend_property_ranges (props, len, new_len);
          add_text_properties_from_list (val, props, make_number (0));
        }
--- 3449,3467 ----
       arguments has text properties, set up text properties of the
       result string.  */
  
!   if (STRING_INTERVALS (args[0]) || info)
      {
        Lisp_Object len, new_len, props;
        struct gcpro gcpro1;
  
        /* Add text properties from the format string.  */
!       len = make_number (SCHARS (args[0]));
        props = text_property_list (args[0], make_number (0), len, Qnil);
        GCPRO1 (props);
  
        if (CONSP (props))
        {
!         new_len = make_number (SCHARS (val));
          extend_property_ranges (props, len, new_len);
          add_text_properties_from_list (val, props, make_number (0));
        }
***************
*** 3472,3478 ****
        for (n = 1; n < nargs; ++n)
          if (info[n].end)
            {
!             len = make_number (XSTRING (args[n])->size);
              new_len = make_number (info[n].end - info[n].start);
              props = text_property_list (args[n], make_number (0), len, Qnil);
              extend_property_ranges (props, len, new_len);
--- 3471,3477 ----
        for (n = 1; n < nargs; ++n)
          if (info[n].end)
            {
!             len = make_number (SCHARS (args[n]));
              new_len = make_number (info[n].end - info[n].start);
              props = text_property_list (args[n], make_number (0), len, Qnil);
              extend_property_ranges (props, len, new_len);



reply via email to

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