static char *mode_line_noprop_buf_end;
static char *mode_line_noprop_ptr;
+#define MODE_LINE_NOPROP_LEN(start) \
+ ((mode_line_noprop_ptr - mode_line_noprop_buf) - start)
+
static enum {
MODE_LINE_DISPLAY = 0,
MODE_LINE_TITLE,
vector = Fmake_vector (make_number (7), Qnil);
AREF (vector, 0) = make_number (mode_line_target);
- AREF (vector, 1) = make_number (mode_line_noprop_ptr - mode_line_noprop_buf);
+ AREF (vector, 1) = make_number (MODE_LINE_NOPROP_LEN (0));
AREF (vector, 2) = mode_line_string_list;
AREF (vector, 3) = mode_line_proptrans_alist;
AREF (vector, 4) = mode_line_string_face;
double the buffer's size. */
if (mode_line_noprop_ptr == mode_line_noprop_buf_end)
{
- int len = mode_line_noprop_ptr - mode_line_noprop_buf;
+ int len = MODE_LINE_NOPROP_LEN (0);
int new_size = 2 * len * sizeof *mode_line_noprop_buf;
mode_line_noprop_buf = (char *) xrealloc (mode_line_noprop_buf, new_size);
mode_line_noprop_buf_end = mode_line_noprop_buf + new_size;
/* Do we have more than one visible frame on this X display? */
Lisp_Object tail;
Lisp_Object fmt;
- char *title_start;
+ int title_start;
+ char *title;
int len;
struct it it;
int count = SPECPDL_INDEX ();
fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;
mode_line_target = MODE_LINE_TITLE;
- title_start = mode_line_noprop_ptr;
+ title_start = MODE_LINE_NOPROP_LEN (0);
init_iterator (&it, XWINDOW (f->selected_window), -1, -1,
NULL, DEFAULT_FACE_ID);
display_mode_element (&it, 0, -1, -1, fmt, Qnil, 0);
- len = mode_line_noprop_ptr - title_start;
-
+ len = MODE_LINE_NOPROP_LEN (title_start);
+ title = mode_line_noprop_buf + title_start;
unbind_to (count, Qnil);
/* Set the title only if it's changed. This avoids consing in
higher level than this.) */
if (! STRINGP (f->name)
|| SBYTES (f->name) != len
- || bcmp (title_start, SDATA (f->name), len) != 0)
- x_implicitly_set_name (f, make_string (title_start, len), Qnil);
+ || bcmp (title, SDATA (f->name), len) != 0)
+ x_implicitly_set_name (f, make_string (title, len), Qnil);
}
}
int no_props = INTEGERP (face);
int count = SPECPDL_INDEX ();
Lisp_Object str;
- char *string_start = NULL;
+ int string_start = 0;
if (NILP (window))
window = selected_window;
mode_line_target = MODE_LINE_NOPROP;
mode_line_string_face_prop = Qnil;
mode_line_string_list = Qnil;
- string_start = mode_line_noprop_ptr;
+ string_start = MODE_LINE_NOPROP_LEN (0);
}
else
{
mode_line_string_face = face;
mode_line_string_face_prop
= (NILP (face) ? Qnil : Fcons (Qface, Fcons (face, Qnil)));
-
- string_start = NULL;
}
push_frame_kboard (it.f);
if (no_props)
{
- len = mode_line_noprop_ptr - string_start;
- str = make_string (string_start, len);
+ len = MODE_LINE_NOPROP_LEN (string_start);
+ str = make_string (mode_line_noprop_buf + string_start, len);
}
else
{