if (STRING_MULTIBYTE (string))
{
- int rest = STRING_BYTES (XSTRING (string)) - BYTEPOS (pos);
- unsigned char *p = XSTRING (string)->data + BYTEPOS (pos);
+ int rest = SBYTES (string) - BYTEPOS (pos);
+ unsigned char *p = SDATA (string) + BYTEPOS (pos);
int len;
while (nchars--)
for (i = 0; i < it->n_overlay_strings; ++i)
{
- char *s = XSTRING (it->overlay_strings[i])->data;
- char *e = s + STRING_BYTES (XSTRING (it->overlay_strings[i]));
+ char *s = SDATA (it->overlay_strings[i]);
+ char *e = s + SBYTES (it->overlay_strings[i]);
while (s < e && *s != '\n')
++s;
/* No face change past the end of the string (for the case
we are padding with spaces). No face change before the
string start. */
- if (IT_STRING_CHARPOS (*it) >= XSTRING (it->string)->size
+ if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string)
|| (IT_STRING_CHARPOS (*it) == 0 && before_p))
return it->face_id;
suitable for unibyte text if IT->string is unibyte. */
if (STRING_MULTIBYTE (it->string))
{
- unsigned char *p = XSTRING (it->string)->data + BYTEPOS (pos);
- int rest = STRING_BYTES (XSTRING (it->string)) - BYTEPOS (pos);
+ unsigned char *p = SDATA (it->string) + BYTEPOS (pos);
+ int rest = SBYTES (it->string) - BYTEPOS (pos);
int c, len;
struct face *face = FACE_FROM_ID (it->f, face_id);
invisible text property can be found in IT->string.
Value will be nil if the property value is the same for
all the rest of IT->string. */
- XSETINT (limit, XSTRING (it->string)->size);
+ XSETINT (limit, SCHARS (it->string));
end_charpos = Fnext_single_property_change (charpos, Qinvisible,
- it->string, limit);
+ it->string, limit);
/* Text at current position is invisible. The next
change in the property is at position end_charpos.
}
else
{
- struct Lisp_String *s = XSTRING (it->string);
- IT_STRING_CHARPOS (*it) = s->size;
- IT_STRING_BYTEPOS (*it) = STRING_BYTES (s);
+ IT_STRING_CHARPOS (*it) = SCHARS (it->string);
+ IT_STRING_BYTEPOS (*it) = SBYTES (it->string);
}
}
}
it->multibyte_p = STRING_MULTIBYTE (it->string);
it->current.overlay_string_index = -1;
IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0;
- it->end_charpos = it->string_nchars
- = XSTRING (it->string)->size;
+ it->end_charpos = it->string_nchars = SCHARS (it->string);
it->method = next_element_from_string;
it->stop_charpos = 0;
it->string_from_display_prop_p = 1;
/* If overlay has a non-empty before-string, record it. */
if ((start == charpos || (end == charpos && invis_p))
&& (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str))
- && XSTRING (str)->size)
+ && SCHARS (str))
RECORD_OVERLAY_STRING (overlay, str, 0);
/* If overlay has a non-empty after-string, record it. */
if ((end == charpos || (start == charpos && invis_p))
&& (str = Foverlay_get (overlay, Qafter_string), STRINGP (str))
- && XSTRING (str)->size)
+ && SCHARS (str))
RECORD_OVERLAY_STRING (overlay, str, 1);
}
/* If overlay has a non-empty before-string, record it. */
if ((start == charpos || (end == charpos && invis_p))
&& (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str))
- && XSTRING (str)->size)
+ && SCHARS (str))
RECORD_OVERLAY_STRING (overlay, str, 0);
/* If overlay has a non-empty after-string, record it. */
if ((end == charpos || (start == charpos && invis_p))
&& (str = Foverlay_get (overlay, Qafter_string), STRINGP (str))
- && XSTRING (str)->size)
+ && SCHARS (str))
RECORD_OVERLAY_STRING (overlay, str, 1);
}
IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0;
it->string = it->overlay_strings[0];
it->stop_charpos = 0;
- it->end_charpos = XSTRING (it->string)->size;
- it->multibyte_p = STRING_MULTIBYTE (it->string);
xassert (STRINGP (it->string));
+ it->end_charpos = SCHARS (it->string);
+ it->multibyte_p = SMBP (it->string);
it->method = next_element_from_string;
}
else
xassert (STRINGP (string));
it->string = string;
it->s = NULL;
- it->end_charpos = it->string_nchars = XSTRING (string)->size;
+ it->end_charpos = it->string_nchars = SCHARS (string);
it->method = next_element_from_string;
it->current.string_pos = string_pos (charpos, string);
}
{
/* IT->string is an overlay string. Advance to the
next, if there is one. */
- if (IT_STRING_CHARPOS (*it) >= XSTRING (it->string)->size)
+ if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string))
next_overlay_string (it);
}
else
its end, and there is something on IT->stack, proceed
with what is on the stack. This can be either another
string, this time an overlay string, or a buffer. */
- if (IT_STRING_CHARPOS (*it) == XSTRING (it->string)->size
+ if (IT_STRING_CHARPOS (*it) == SCHARS (it->string)
&& it->sp > 0)
{
pop_it (it);
/* Get the next character from an overlay string. In overlay
strings, There is no field width or padding with spaces to
do. */
- if (IT_STRING_CHARPOS (*it) >= XSTRING (it->string)->size)
+ if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string))
{
it->what = IT_EOB;
return 0;
}
else if (STRING_MULTIBYTE (it->string))
{
- int remaining = (STRING_BYTES (XSTRING (it->string))
- - IT_STRING_BYTEPOS (*it));
- unsigned char *s = (XSTRING (it->string)->data
- + IT_STRING_BYTEPOS (*it));
+ int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
+ unsigned char *s = SDATA (it->string) + IT_STRING_BYTEPOS (*it);
it->c = string_char_and_length (s, remaining, &it->len);
}
else
{
- it->c = XSTRING (it->string)->data[IT_STRING_BYTEPOS (*it)];
+ it->c = SREF (it->string, IT_STRING_BYTEPOS (*it));
it->len = 1;
}
}
}
else if (STRING_MULTIBYTE (it->string))
{
- int maxlen = (STRING_BYTES (XSTRING (it->string))
- - IT_STRING_BYTEPOS (*it));
- unsigned char *s = (XSTRING (it->string)->data
- + IT_STRING_BYTEPOS (*it));
+ int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
+ unsigned char *s = SDATA (it->string) + IT_STRING_BYTEPOS (*it);
it->c = string_char_and_length (s, maxlen, &it->len);
}
else
{
- it->c = XSTRING (it->string)->data[IT_STRING_BYTEPOS (*it)];
+ it->c = SREF (it->string, IT_STRING_BYTEPOS (*it));
it->len = 1;
}
}
args[2] = arg2;
msg = Fformat (3, args);
- len = STRING_BYTES (XSTRING (msg)) + 1;
+ len = SBYTES (msg) + 1;
buffer = (char *) alloca (len);
- bcopy (XSTRING (msg)->data, buffer, len);
+ bcopy (SDATA (msg), buffer, len);
message_dolog (buffer, len - 1, 1, 0);
UNGCPRO;
/* First flush out any partial line written with print. */
message_log_maybe_newline ();
if (STRINGP (m))
- message_dolog (XSTRING (m)->data, nbytes, 1, multibyte);
+ message_dolog (SDATA (m), nbytes, 1, multibyte);
message3_nolog (m, nbytes, multibyte);
UNGCPRO;
putc ('\n', stderr);
noninteractive_need_newline = 0;
if (STRINGP (m))
- fwrite (XSTRING (m)->data, nbytes, 1, stderr);
+ fwrite (SDATA (m), nbytes, 1, stderr);
if (cursor_in_echo_area == 0)
fprintf (stderr, "\n");
fflush (stderr);
&& !FRAME_VISIBLE_P (f))
Fmake_frame_visible (frame);
- if (STRINGP (m) && XSTRING (m)->size)
+ if (STRINGP (m) && SCHARS (m) > 0)
{
set_message (NULL, m, nbytes, multibyte);
if (minibuffer_auto_raise)
if (noninteractive_need_newline)
putc ('\n', stderr);
noninteractive_need_newline = 0;
- fprintf (stderr, m, XSTRING (string)->data);
+ fprintf (stderr, m, SDATA (string));
if (cursor_in_echo_area == 0)
fprintf (stderr, "\n");
fflush (stderr);
message = Fformat (2, args);
if (log)
- message3 (message, STRING_BYTES (XSTRING (message)),
- STRING_MULTIBYTE (message));
+ message3 (message, SBYTES (message), SMBP (message));
else
- message3_nolog (message, STRING_BYTES (XSTRING (message)),
- STRING_MULTIBYTE (message));
+ message3_nolog (message, SBYTES (message), SMBP (message));
UNGCPRO;
{
Lisp_Object string;
string = Fcurrent_message ();
- message3 (string, XSTRING (string)->size,
+ message3 (string, SBYTES (string),
!NILP (current_buffer->enable_multibyte_characters));
}
}
xassert (CONSP (Vmessage_stack));
msg = XCAR (Vmessage_stack);
if (STRINGP (msg))
- message3_nolog (msg, STRING_BYTES (XSTRING (msg)), STRING_MULTIBYTE (msg));
+ message3_nolog (msg, SBYTES (msg), SMBP (msg));
else
message3_nolog (msg, 0, 0);
}
int nchars;
if (nbytes == 0)
- nbytes = XSTRING (string)->size_byte;
+ nbytes = SBYTES (string);
nchars = string_byte_to_char (string, nbytes);
/* This function takes care of single/multibyte conversion. We
display_mode_element, then we might need to optimize at a
higher level than this.) */
if (! STRINGP (f->name)
- || STRING_BYTES (XSTRING (f->name)) != len
- || bcmp (frame_title_buf, XSTRING (f->name)->data, len) != 0)
+ || SBYTES (f->name) != len
+ || bcmp (frame_title_buf, SDATA (f->name), len) != 0)
x_implicitly_set_name (f, make_string (frame_title_buf, len), Qnil);
}
}
/* The size of the string we might be able to reuse. */
size = (STRINGP (f->desired_tool_bar_string)
- ? XSTRING (f->desired_tool_bar_string)->size
+ ? SCHARS (f->desired_tool_bar_string)
: 0);
/* We need one space in the string for each image. */
string. The string can be longer than needed when we reuse a
previous string. */
if (i + 1 == f->n_tool_bar_items)
- end = XSTRING (f->desired_tool_bar_string)->size;
+ end = SCHARS (f->desired_tool_bar_string);
else
end = i + 1;
Fadd_text_properties (make_number (i), make_number (end),
/* This function can be called asynchronously, which means we must
exclude any possibility that Fget_text_property signals an
error. */
- charpos = min (XSTRING (f->current_tool_bar_string)->size, glyph->charpos);
+ charpos = min (SCHARS (f->current_tool_bar_string), glyph->charpos);
charpos = max (0, charpos);
/* Get the text property `menu-item' at pos. The value of that
w,
((BUFFERP (w->buffer)
&& STRINGP (XBUFFER (w->buffer)->name))
- ? (char *) XSTRING (XBUFFER (w->buffer)->name)->data
+ ? (char *) SDATA (XBUFFER (w->buffer)->name)
: "no buffer"),
buffer);
}
Lisp_Object *args;
{
Lisp_Object s = Fformat (nargs, args);
- fprintf (stderr, "%s", XSTRING (s)->data);
+ fprintf (stderr, "%s", SDATA (s));
return Qnil;
}
struct frame *f = XFRAME (WINDOW_FRAME (w));
struct buffer *buffer = XBUFFER (w->buffer);
struct buffer *old = current_buffer;
- unsigned char *arrow_string = XSTRING (Voverlay_arrow_string)->data;
- int arrow_len = XSTRING (Voverlay_arrow_string)->size;
+ unsigned char *arrow_string = SDATA (Voverlay_arrow_string);
+ int arrow_len = SCHARS (Voverlay_arrow_string);
unsigned char *arrow_end = arrow_string + arrow_len;
unsigned char *p;
struct it it;
/* Display the item, pad with one space. */
if (it.current_x < it.last_visible_x)
display_string (NULL, string, Qnil, 0, 0, &it,
- XSTRING (string)->size + 1, 0, 0, -1);
+ SCHARS (string) + 1, 0, 0, -1);
}
/* Fill out the line with spaces. */
}
}
- this = XSTRING (elt)->data;
+ this = SDATA (elt);
lisp_string = this;
if (literal)
{
prec = precision - n;
if (frame_title_ptr)
- n += store_frame_title (XSTRING (elt)->data, -1, prec);
+ n += store_frame_title (SDATA (elt), -1, prec);
else
n += display_string (NULL, elt, Qnil, 0, 0, it,
0, prec, 0, STRING_MULTIBYTE (elt));
/* Mention the EOL conversion if it is not the usual one. */
if (STRINGP (eoltype))
{
- eol_str = XSTRING (eoltype)->data;
- eol_str_len = XSTRING (eoltype)->size;
+ eol_str = SDATA (eoltype);
+ eol_str_len = SBYTES (eoltype);
}
else if (INTEGERP (eoltype)
&& CHAR_VALID_P (XINT (eoltype), 0))
case 'F':
/* %F displays the frame name. */
if (!NILP (f->title))
- return (char *) XSTRING (f->title)->data;
+ return (char *) SDATA (f->title);
if (f->explicit_name || ! FRAME_WINDOW_P (f))
- return (char *) XSTRING (f->name)->data;
+ return (char *) SDATA (f->name);
return "Emacs";
case 'f':
if (STRINGP (obj))
{
*multibyte = STRING_MULTIBYTE (obj);
- return (char *) XSTRING (obj)->data;
+ return (char *) SDATA (obj);
}
else
return "";