diff options
-rw-r--r-- | src/ChangeLog | 22 | ||||
-rw-r--r-- | src/abbrev.c | 10 | ||||
-rw-r--r-- | src/alloc.c | 34 | ||||
-rw-r--r-- | src/buffer.c | 58 | ||||
-rw-r--r-- | src/bytecode.c | 10 | ||||
-rw-r--r-- | src/callint.c | 12 | ||||
-rw-r--r-- | src/callproc.c | 58 | ||||
-rw-r--r-- | src/casefiddle.c | 12 | ||||
-rw-r--r-- | src/category.c | 4 | ||||
-rw-r--r-- | src/ccl.c | 6 | ||||
-rw-r--r-- | src/charset.c | 16 | ||||
-rw-r--r-- | src/charset.h | 6 | ||||
-rw-r--r-- | src/coding.c | 82 | ||||
-rw-r--r-- | src/composite.c | 12 | ||||
-rw-r--r-- | src/data.c | 50 | ||||
-rw-r--r-- | src/dired.c | 70 | ||||
-rw-r--r-- | src/dispnew.c | 12 | ||||
-rw-r--r-- | src/disptab.h | 4 | ||||
-rw-r--r-- | src/doc.c | 68 | ||||
-rw-r--r-- | src/dosfns.c | 4 | ||||
-rw-r--r-- | src/editfns.c | 77 | ||||
-rw-r--r-- | src/emacs.c | 22 | ||||
-rw-r--r-- | src/eval.c | 10 | ||||
-rw-r--r-- | src/fileio.c | 278 | ||||
-rw-r--r-- | src/filelock.c | 16 | ||||
-rw-r--r-- | src/fns.c | 204 | ||||
-rw-r--r-- | src/fontset.c | 38 | ||||
-rw-r--r-- | src/frame.c | 34 | ||||
-rw-r--r-- | src/indent.c | 6 | ||||
-rw-r--r-- | src/insdel.c | 22 | ||||
-rw-r--r-- | src/intervals.c | 18 | ||||
-rw-r--r-- | src/keyboard.c | 80 | ||||
-rw-r--r-- | src/keymap.c | 34 | ||||
-rw-r--r-- | src/lread.c | 102 | ||||
-rw-r--r-- | src/mac.c | 12 | ||||
-rw-r--r-- | src/macfns.c | 192 | ||||
-rw-r--r-- | src/macmenu.c | 26 | ||||
-rw-r--r-- | src/macterm.c | 30 | ||||
-rw-r--r-- | src/minibuf.c | 106 | ||||
-rw-r--r-- | src/msdos.c | 10 | ||||
-rw-r--r-- | src/print.c | 56 | ||||
-rw-r--r-- | src/process.c | 132 | ||||
-rw-r--r-- | src/search.c | 96 | ||||
-rw-r--r-- | src/sound.c | 16 | ||||
-rw-r--r-- | src/sunfns.c | 12 | ||||
-rw-r--r-- | src/syntax.c | 20 | ||||
-rw-r--r-- | src/syntax.h | 2 | ||||
-rw-r--r-- | src/sysdep.c | 8 | ||||
-rw-r--r-- | src/textprop.c | 16 | ||||
-rw-r--r-- | src/undo.c | 6 | ||||
-rw-r--r-- | src/w16select.c | 10 | ||||
-rw-r--r-- | src/w32.c | 4 | ||||
-rw-r--r-- | src/w32fns.c | 254 | ||||
-rw-r--r-- | src/w32menu.c | 26 | ||||
-rw-r--r-- | src/w32proc.c | 8 | ||||
-rw-r--r-- | src/w32select.c | 12 | ||||
-rw-r--r-- | src/w32term.c | 26 | ||||
-rw-r--r-- | src/window.c | 2 | ||||
-rw-r--r-- | src/xdisp.c | 8 | ||||
-rw-r--r-- | src/xfaces.c | 114 | ||||
-rw-r--r-- | src/xfns.c | 272 | ||||
-rw-r--r-- | src/xmenu.c | 60 | ||||
-rw-r--r-- | src/xselect.c | 16 | ||||
-rw-r--r-- | src/xsmfns.c | 18 | ||||
-rw-r--r-- | src/xterm.c | 56 |
65 files changed, 1569 insertions, 1548 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5486ef8bf75..791c4f36150 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2002-07-14 Ken Raeburn <raeburn@gnu.org> + + * lisp.h (SMBP): Deleted. All uses changed to STRING_MULTIBYTE. + (STRING_SET_UNIBYTE): New macro. + (SET_STRING_BYTES): Deleted. Callers (all of which supplied a + length of -1) changed to use STRING_SET_UNIBYTE. + + * abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, + casefiddle.c, category.c, ccl.c, charset.c, charset.h, coding.c, + composite.c, data.c, dired.c, dispnew.c, disptab.h, doc.c, + dosfns.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fn.c, + fontset.c, frame.c, indent.c, insdel.c, intervals.c, keyboard.c, + keymap.c, lread.c, mac.c, macfns.c, macmenu.c, macterm.c, + minibuf.c, msdos.c, print.c, process.c, search.c, sound.c, + sunfns.c, syntax.c, syntax.h, sysdep.c, textprop.c, undo.c, + w16select.c, w32.c, w32fns.c, w32menu.c, w32proc.c, w32select.c, + w32term.c, window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, + xselect.c, xsmfns.c, xterm.c: Most uses of XSTRING combined with + STRING_BYTES or indirection changed to SCHARS, SBYTES, + STRING_INTERVALS, SREF, SDATA; explicit size_byte references left + unchanged for now. + 2002-07-13 Kim F. Storm <storm@cua.dk> * keyboard.c (command_loop_1): Invert check on Vmemory_full. diff --git a/src/abbrev.c b/src/abbrev.c index 8cf1c3ebb6f..6e973e9c307 100644 --- a/src/abbrev.c +++ b/src/abbrev.c @@ -344,8 +344,8 @@ Returns the abbrev symbol, if expansion took place. */) del_range_both (wordstart, wordstart_byte, wordend, wordend_byte, 1); - insert_from_string (expansion, 0, 0, XSTRING (expansion)->size, - STRING_BYTES (XSTRING (expansion)), 1); + insert_from_string (expansion, 0, 0, SCHARS (expansion), + SBYTES (expansion), 1); SET_PT (PT + whitecnt); if (uccount && !lccount) @@ -427,11 +427,11 @@ is not undone. */) if (!STRINGP (val)) error ("value of abbrev-symbol must be a string"); zv_before = ZV; - del_range_byte (PT_BYTE, PT_BYTE + STRING_BYTES (XSTRING (val)), 1); + del_range_byte (PT_BYTE, PT_BYTE + SBYTES (val), 1); /* Don't inherit properties here; just copy from old contents. */ insert_from_string (Vlast_abbrev_text, 0, 0, - XSTRING (Vlast_abbrev_text)->size, - STRING_BYTES (XSTRING (Vlast_abbrev_text)), 0); + SCHARS (Vlast_abbrev_text), + SBYTES (Vlast_abbrev_text), 0); Vlast_abbrev_text = Qnil; /* Total number of characters deleted. */ adjust = ZV - zv_before; diff --git a/src/alloc.c b/src/alloc.c index 5bb636b549c..80b63345459 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1684,8 +1684,8 @@ Both LENGTH and INIT must be numbers. */) { nbytes = XINT (length); val = make_uninit_string (nbytes); - p = XSTRING (val)->data; - end = p + XSTRING (val)->size; + p = SDATA (val); + end = p + SCHARS (val); while (p != end) *p++ = c; } @@ -1696,7 +1696,7 @@ Both LENGTH and INIT must be numbers. */) nbytes = len * XINT (length); val = make_uninit_multibyte_string (XINT (length), nbytes); - p = XSTRING (val)->data; + p = SDATA (val); end = p + nbytes; while (p != end) { @@ -1783,8 +1783,8 @@ make_unibyte_string (contents, length) { register Lisp_Object val; val = make_uninit_string (length); - bcopy (contents, XSTRING (val)->data, length); - SET_STRING_BYTES (XSTRING (val), -1); + bcopy (contents, SDATA (val), length); + STRING_SET_UNIBYTE (val); return val; } @@ -1799,7 +1799,7 @@ make_multibyte_string (contents, nchars, nbytes) { register Lisp_Object val; val = make_uninit_multibyte_string (nchars, nbytes); - bcopy (contents, XSTRING (val)->data, nbytes); + bcopy (contents, SDATA (val), nbytes); return val; } @@ -1814,9 +1814,9 @@ make_string_from_bytes (contents, nchars, nbytes) { register Lisp_Object val; val = make_uninit_multibyte_string (nchars, nbytes); - bcopy (contents, XSTRING (val)->data, nbytes); - if (STRING_BYTES (XSTRING (val)) == XSTRING (val)->size) - SET_STRING_BYTES (XSTRING (val), -1); + bcopy (contents, SDATA (val), nbytes); + if (SBYTES (val) == SCHARS (val)) + STRING_SET_UNIBYTE (val); return val; } @@ -1833,9 +1833,9 @@ make_specified_string (contents, nchars, nbytes, multibyte) { register Lisp_Object val; val = make_uninit_multibyte_string (nchars, nbytes); - bcopy (contents, XSTRING (val)->data, nbytes); + bcopy (contents, SDATA (val), nbytes); if (!multibyte) - SET_STRING_BYTES (XSTRING (val), -1); + STRING_SET_UNIBYTE (val); return val; } @@ -1860,7 +1860,7 @@ make_uninit_string (length) { Lisp_Object val; val = make_uninit_multibyte_string (length, length); - SET_STRING_BYTES (XSTRING (val), -1); + STRING_SET_UNIBYTE (val); return val; } @@ -2701,10 +2701,10 @@ make_event_array (nargs, args) result = Fmake_string (make_number (nargs), make_number (0)); for (i = 0; i < nargs; i++) { - XSTRING (result)->data[i] = XINT (args[i]); + SREF (result, i) = XINT (args[i]); /* Move the meta bit to the right place for a string char. */ if (XINT (args[i]) & CHAR_META) - XSTRING (result)->data[i] |= 0x80; + SREF (result, i) |= 0x80; } return result; @@ -3955,8 +3955,8 @@ Does not copy symbols. Copies strings without text properties. */) else if (FLOATP (obj)) return make_pure_float (XFLOAT_DATA (obj)); else if (STRINGP (obj)) - return make_pure_string (XSTRING (obj)->data, XSTRING (obj)->size, - STRING_BYTES (XSTRING (obj)), + return make_pure_string (SDATA (obj), SCHARS (obj), + SBYTES (obj), STRING_MULTIBYTE (obj)); else if (COMPILEDP (obj) || VECTORP (obj)) { @@ -4700,7 +4700,7 @@ mark_object (argptr) if (!PURE_POINTER_P (XSTRING (ptr->xname))) MARK_STRING (XSTRING (ptr->xname)); - MARK_INTERVAL_TREE (XSTRING (ptr->xname)->intervals); + MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->xname)); /* Note that we do not mark the obarray of the symbol. It is safe not to do so because nothing accesses that diff --git a/src/buffer.c b/src/buffer.c index a5bc8532cfb..8ee60578311 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -193,7 +193,7 @@ nsberror (spec) Lisp_Object spec; { if (STRINGP (spec)) - error ("No buffer named %s", XSTRING (spec)->data); + error ("No buffer named %s", SDATA (spec)); error ("Invalid buffer argument"); } @@ -341,7 +341,7 @@ The value is never nil. */) if (!NILP (buf)) return buf; - if (XSTRING (name)->size == 0) + if (SCHARS (name) == 0) error ("Empty string for buffer name is not allowed"); b = (struct buffer *) allocate_buffer (); @@ -397,10 +397,10 @@ The value is never nil. */) b->zv_marker = Qnil; name = Fcopy_sequence (name); - XSTRING (name)->intervals = NULL_INTERVAL; + STRING_INTERVALS (name) = NULL_INTERVAL; b->name = name; - if (XSTRING (name)->data[0] != ' ') + if (SREF (name, 0) != ' ') b->undo_list = Qnil; else b->undo_list = Qt; @@ -520,13 +520,13 @@ CLONE nil means the indirect buffer's state is reset to default values. */) buf = Fget_buffer (name); if (!NILP (buf)) - error ("Buffer name `%s' is in use", XSTRING (name)->data); + error ("Buffer name `%s' is in use", SDATA (name)); base_buffer = Fget_buffer (base_buffer); if (NILP (base_buffer)) - error ("No such buffer: `%s'", XSTRING (name)->data); + error ("No such buffer: `%s'", SDATA (name)); - if (XSTRING (name)->size == 0) + if (SCHARS (name) == 0) error ("Empty string for buffer name is not allowed"); b = (struct buffer *) allocate_buffer (); @@ -556,7 +556,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) all_buffers = b; name = Fcopy_sequence (name); - XSTRING (name)->intervals = NULL_INTERVAL; + STRING_INTERVALS (name) = NULL_INTERVAL; b->name = name; reset_buffer (b); @@ -1091,7 +1091,7 @@ This does not change the name of the visited file (if any). */) CHECK_STRING (newname); - if (XSTRING (newname)->size == 0) + if (SCHARS (newname) == 0) error ("Empty string is invalid as a buffer name"); tem = Fget_buffer (newname); @@ -1106,7 +1106,7 @@ This does not change the name of the visited file (if any). */) if (!NILP (unique)) newname = Fgenerate_new_buffer_name (newname, current_buffer->name); else - error ("Buffer name `%s' is in use", XSTRING (newname)->data); + error ("Buffer name `%s' is in use", SDATA (newname)); } current_buffer->name = newname; @@ -1163,7 +1163,7 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) buf = Fcdr (Fcar (tail)); if (EQ (buf, buffer)) continue; - if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') + if (SDATA (XBUFFER (buf)->name)[0] == ' ') continue; /* If the selected frame has a buffer_predicate, disregard buffers that don't fit the predicate. */ @@ -1289,7 +1289,7 @@ with SIGHUP. */) { GCPRO1 (buf); tem = do_yes_or_no_p (format1 ("Buffer %s modified; kill anyway? ", - XSTRING (b->name)->data)); + SDATA (b->name))); UNGCPRO; if (NILP (tem)) return Qnil; @@ -1535,7 +1535,7 @@ the current buffer's major mode. */) Lisp_Object function; if (STRINGP (XBUFFER (buffer)->name) - && strcmp (XSTRING (XBUFFER (buffer)->name)->data, "*scratch*") == 0) + && strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0) function = find_symbol_value (intern ("initial-major-mode")); else { @@ -2883,24 +2883,24 @@ record_overlay_string (ssl, str, str2, pri, size) ssl->used++; if (NILP (current_buffer->enable_multibyte_characters)) - nbytes = XSTRING (str)->size; + nbytes = SCHARS (str); else if (! STRING_MULTIBYTE (str)) - nbytes = count_size_as_multibyte (XSTRING (str)->data, - STRING_BYTES (XSTRING (str))); + nbytes = count_size_as_multibyte (SDATA (str), + SBYTES (str)); else - nbytes = STRING_BYTES (XSTRING (str)); + nbytes = SBYTES (str); ssl->bytes += nbytes; if (STRINGP (str2)) { if (NILP (current_buffer->enable_multibyte_characters)) - nbytes = XSTRING (str2)->size; + nbytes = SCHARS (str2); else if (! STRING_MULTIBYTE (str2)) - nbytes = count_size_as_multibyte (XSTRING (str2)->data, - STRING_BYTES (XSTRING (str2))); + nbytes = count_size_as_multibyte (SDATA (str2), + SBYTES (str2)); else - nbytes = STRING_BYTES (XSTRING (str2)); + nbytes = SBYTES (str2); ssl->bytes += nbytes; } @@ -3012,8 +3012,8 @@ overlay_strings (pos, w, pstr) { int nbytes; tem = overlay_tails.buf[i].string; - nbytes = copy_text (XSTRING (tem)->data, p, - STRING_BYTES (XSTRING (tem)), + nbytes = copy_text (SDATA (tem), p, + SBYTES (tem), STRING_MULTIBYTE (tem), multibyte); p += nbytes; } @@ -3021,15 +3021,15 @@ overlay_strings (pos, w, pstr) { int nbytes; tem = overlay_heads.buf[i].string; - nbytes = copy_text (XSTRING (tem)->data, p, - STRING_BYTES (XSTRING (tem)), + nbytes = copy_text (SDATA (tem), p, + SBYTES (tem), STRING_MULTIBYTE (tem), multibyte); p += nbytes; tem = overlay_heads.buf[i].string2; if (STRINGP (tem)) { - nbytes = copy_text (XSTRING (tem)->data, p, - STRING_BYTES (XSTRING (tem)), + nbytes = copy_text (SDATA (tem), p, + SBYTES (tem), STRING_MULTIBYTE (tem), multibyte); p += nbytes; } @@ -4282,7 +4282,7 @@ buffer_slot_type_mismatch (offset) sym = PER_BUFFER_SYMBOL (offset); error ("Only %s should be stored in the buffer-local variable %s", - type_name, XSTRING (SYMBOL_NAME (sym))->data); + type_name, SDATA (SYMBOL_NAME (sym))); } @@ -5066,7 +5066,7 @@ init_buffer () because of the ange-ftp completion handler. However, it is not necessary to turn / into /:/. So avoid doing that. */ - && strcmp ("/", XSTRING (current_buffer->directory)->data)) + && strcmp ("/", SDATA (current_buffer->directory))) current_buffer->directory = concat2 (build_string ("/:"), current_buffer->directory); diff --git a/src/bytecode.c b/src/bytecode.c index 7f58b4d17ab..bcb80596944 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -327,10 +327,10 @@ unmark_byte_stack () XUNMARK (stack->byte_string); XUNMARK (stack->constants); - if (stack->byte_string_start != XSTRING (stack->byte_string)->data) + if (stack->byte_string_start != SDATA (stack->byte_string)) { int offset = stack->pc - stack->byte_string_start; - stack->byte_string_start = XSTRING (stack->byte_string)->data; + stack->byte_string_start = SDATA (stack->byte_string); stack->pc = stack->byte_string_start + offset; } } @@ -460,11 +460,11 @@ If the third argument is incorrect, Emacs may crash. */) convert them back to the originally intended unibyte form. */ bytestr = Fstring_as_unibyte (bytestr); - bytestr_length = STRING_BYTES (XSTRING (bytestr)); + bytestr_length = SBYTES (bytestr); vectorp = XVECTOR (vector)->contents; stack.byte_string = bytestr; - stack.pc = stack.byte_string_start = XSTRING (bytestr)->data; + stack.pc = stack.byte_string_start = SDATA (bytestr); stack.constants = vector; stack.bottom = (Lisp_Object *) alloca (XFASTINT (maxdepth) * sizeof (Lisp_Object)); @@ -896,7 +896,7 @@ If the third argument is incorrect, Emacs may crash. */) case Btemp_output_buffer_setup: BEFORE_POTENTIAL_GC (); CHECK_STRING (TOP); - temp_output_buffer_setup (XSTRING (TOP)->data); + temp_output_buffer_setup (SDATA (TOP)); AFTER_POTENTIAL_GC (); TOP = Vstandard_output; break; diff --git a/src/callint.c b/src/callint.c index 4bb5cd57ccf..a1c28ca1b13 100644 --- a/src/callint.c +++ b/src/callint.c @@ -288,9 +288,9 @@ supply if the command inquires which events were used to invoke it. */) { /* Make a copy of string so that if a GC relocates specs, `string' will still be valid. */ - string = (unsigned char *) alloca (STRING_BYTES (XSTRING (specs)) + 1); - bcopy (XSTRING (specs)->data, string, - STRING_BYTES (XSTRING (specs)) + 1); + string = (unsigned char *) alloca (SBYTES (specs) + 1); + bcopy (SDATA (specs), string, + SBYTES (specs) + 1); } else if (string == 0) { @@ -453,7 +453,7 @@ supply if the command inquires which events were used to invoke it. */) argstrings[j] = (EQ (visargs[j], Qnil) ? (unsigned char *) "" - : XSTRING (visargs[j])->data); + : SDATA (visargs[j])); /* Process the format-string in prompt1, putting the output into callint_message. Make callint_message bigger if necessary. @@ -599,7 +599,7 @@ supply if the command inquires which events were used to invoke it. */) if (next_event >= key_count) error ("%s must be bound to an event with parameters", (SYMBOLP (function) - ? (char *) XSTRING (SYMBOL_NAME (function))->data + ? (char *) SDATA (SYMBOL_NAME (function)) : "command")); args[i] = XVECTOR (keys)->contents[next_event++]; varies[i] = -1; @@ -644,7 +644,7 @@ supply if the command inquires which events were used to invoke it. */) tem = Fread_from_minibuffer (build_string (callint_message), Qnil, Qnil, Qnil, Qnil, Qnil, Qnil); - if (! STRINGP (tem) || XSTRING (tem)->size == 0) + if (! STRINGP (tem) || SCHARS (tem) == 0) args[i] = Qnil; else args[i] = Fread (tem); diff --git a/src/callproc.c b/src/callproc.c index c95055c67aa..68c4306b9ca 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -159,8 +159,8 @@ call_process_cleanup (fdpid) register Lisp_Object file; file = Fcdr (fdpid); emacs_close (XFASTINT (Fcar (fdpid))); - if (strcmp (XSTRING (file)-> data, NULL_DEVICE) != 0) - unlink (XSTRING (file)->data); + if (strcmp (SDATA (file), NULL_DEVICE) != 0) + unlink (SDATA (file)); #else /* not MSDOS and not MAC_OS8 */ register int pid = XFASTINT (Fcdr (fdpid)); @@ -371,7 +371,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) display = nargs >= 4 ? args[3] : Qnil; - filefd = emacs_open (XSTRING (infile)->data, O_RDONLY, 0); + filefd = emacs_open (SDATA (infile), O_RDONLY, 0); if (filefd < 0) { report_file_error ("Opening process input file", Fcons (infile, Qnil)); @@ -389,7 +389,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) emacs_close (filefd); report_file_error ("Searching for program", Fcons (args[0], Qnil)); } - new_argv[0] = XSTRING (path)->data; + new_argv[0] = SDATA (path); if (nargs > 4) { register int i; @@ -407,7 +407,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (argument_coding.type == coding_type_ccl) setup_ccl_program (&(argument_coding.spec.ccl.encoder), Qnil); } - new_argv[i - 3] = XSTRING (args[i])->data; + new_argv[i - 3] = SDATA (args[i]); } UNGCPRO; new_argv[nargs - 3] = 0; @@ -443,9 +443,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) #ifdef MAC_OS8 /* Since we don't have pipes on the Mac, create a temporary file to hold the output of the subprocess. */ - tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); - bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile, - STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); + tempfile = (char *) alloca (SBYTES (Vtemp_file_name_pattern) + 1); + bcopy (SDATA (Vtemp_file_name_pattern), tempfile, + SBYTES (Vtemp_file_name_pattern) + 1); mktemp (tempfile); @@ -505,11 +505,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) else if (STRINGP (error_file)) { #ifdef DOS_NT - fd_error = emacs_open (XSTRING (error_file)->data, + fd_error = emacs_open (SDATA (error_file), O_WRONLY | O_TRUNC | O_CREAT | O_TEXT, S_IREAD | S_IWRITE); #else /* not DOS_NT */ - fd_error = creat (XSTRING (error_file)->data, 0666); + fd_error = creat (SDATA (error_file), 0666); #endif /* not DOS_NT */ } @@ -545,15 +545,15 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) close (fd_error); fd1 = -1; /* No harm in closing that one! */ - infn = XSTRING (infile)->data; + infn = SDATA (infile); outfn = tempfile; if (NILP (error_file)) errfn = NULL_DEVICE; else if (EQ (Qt, error_file)) errfn = outfn; else - errfn = XSTRING (error_file)->data; - currdn = XSTRING (current_dir)->data; + errfn = SDATA (error_file); + currdn = SDATA (current_dir); pid = run_mac_command (new_argv, currdn, infn, outfn, errfn); /* Record that the synchronous process exited and note its @@ -1047,9 +1047,9 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r strcat (tempfile, "detmp.XXX"); #endif #else /* not DOS_NT */ - char *tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); - bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile, - STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); + char *tempfile = (char *) alloca (SBYTES (Vtemp_file_name_pattern) + 1); + bcopy (SDATA (Vtemp_file_name_pattern), tempfile, + SBYTES (Vtemp_file_name_pattern) + 1); #endif /* not DOS_NT */ coding_systems = Qt; @@ -1188,7 +1188,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) register char *temp; register int i; - i = STRING_BYTES (XSTRING (current_dir)); + i = SBYTES (current_dir); #ifdef MSDOS /* MSDOS must have all environment variables malloc'ed, because low-level libc functions that launch subsidiary processes rely @@ -1199,7 +1199,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) #endif temp = pwd_var + 4; bcopy ("PWD=", pwd_var, 4); - bcopy (XSTRING (current_dir)->data, temp, i); + bcopy (SDATA (current_dir), temp, i); if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP; temp[i] = 0; @@ -1253,7 +1253,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) tem = XCDR (tem)) { char **ep = env; - char *string = (char *) XSTRING (XCAR (tem))->data; + char *string = (char *) SDATA (XCAR (tem)); /* See if this string duplicates any string already in the env. If so, don't put it in. When an env var has multiple definitions, @@ -1280,7 +1280,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) } #ifdef WINDOWSNT prepare_standard_handles (in, out, err, handles); - set_process_dir (XSTRING (current_dir)->data); + set_process_dir (SDATA (current_dir)); #else /* not WINDOWSNT */ /* Make sure that in, out, and err are not actually already in descriptors zero, one, or two; this could happen if Emacs is @@ -1405,18 +1405,18 @@ getenv_internal (var, varlen, value, valuelen) entry = XCAR (scan); if (STRINGP (entry) - && STRING_BYTES (XSTRING (entry)) > varlen - && XSTRING (entry)->data[varlen] == '=' + && SBYTES (entry) > varlen + && SREF (entry, varlen) == '=' #ifdef WINDOWSNT /* NT environment variables are case insensitive. */ - && ! strnicmp (XSTRING (entry)->data, var, varlen) + && ! strnicmp (SDATA (entry), var, varlen) #else /* not WINDOWSNT */ - && ! bcmp (XSTRING (entry)->data, var, varlen) + && ! bcmp (SDATA (entry), var, varlen) #endif /* not WINDOWSNT */ ) { - *value = (char *) XSTRING (entry)->data + (varlen + 1); - *valuelen = STRING_BYTES (XSTRING (entry)) - (varlen + 1); + *value = (char *) SDATA (entry) + (varlen + 1); + *valuelen = SBYTES (entry) - (varlen + 1); return 1; } } @@ -1435,7 +1435,7 @@ This function consults the variable ``process-environment'' for its value. */) int valuelen; CHECK_STRING (var); - if (getenv_internal (XSTRING (var)->data, STRING_BYTES (XSTRING (var)), + if (getenv_internal (SDATA (var), SBYTES (var), &value, &valuelen)) return make_string (value, valuelen); else @@ -1550,13 +1550,13 @@ init_callproc () #endif { tempdir = Fdirectory_file_name (Vexec_directory); - if (access (XSTRING (tempdir)->data, 0) < 0) + if (access (SDATA (tempdir), 0) < 0) dir_warning ("Warning: arch-dependent data dir (%s) does not exist.\n", Vexec_directory); } tempdir = Fdirectory_file_name (Vdata_directory); - if (access (XSTRING (tempdir)->data, 0) < 0) + if (access (SDATA (tempdir), 0) < 0) dir_warning ("Warning: arch-independent data dir (%s) does not exist.\n", Vdata_directory); diff --git a/src/casefiddle.c b/src/casefiddle.c index c449547bf1d..78c3bb2e8c7 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -68,12 +68,12 @@ casify_object (flag, obj) int multibyte = STRING_MULTIBYTE (obj); obj = Fcopy_sequence (obj); - len = STRING_BYTES (XSTRING (obj)); + len = SBYTES (obj); /* Scan all single-byte characters from start of string. */ for (i = 0; i < len;) { - c = XSTRING (obj)->data[i]; + c = SREF (obj, i); if (multibyte && c >= 0x80) /* A multibyte character can't be handled in this @@ -90,7 +90,7 @@ casify_object (flag, obj) : ! SINGLE_BYTE_CHAR_P (c)) break; - XSTRING (obj)->data[i] = c; + SREF (obj, i) = c; if ((int) flag >= (int) CASE_CAPITALIZE) inword = SYNTAX (c) == Sword; i++; @@ -107,12 +107,12 @@ casify_object (flag, obj) = (char *) alloca ((len - i) * MAX_MULTIBYTE_LENGTH + i); /* Copy data already handled. */ - bcopy (XSTRING (obj)->data, buf, i); + bcopy (SDATA (obj), buf, i); /* From now on, I counts bytes. */ while (i < len) { - c = STRING_CHAR_AND_LENGTH (XSTRING (obj)->data + i, + c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i, len - i, fromlen); if (inword && flag != CASE_CAPITALIZE_UP) c = DOWNCASE (c); @@ -124,7 +124,7 @@ casify_object (flag, obj) if ((int) flag >= (int) CASE_CAPITALIZE) inword = SYNTAX (c) == Sword; } - obj = make_multibyte_string (buf, XSTRING (obj)->size, + obj = make_multibyte_string (buf, SCHARS (obj), j_byte); } return obj; diff --git a/src/category.c b/src/category.c index bbd4686ed86..c7ae2ccf90d 100644 --- a/src/category.c +++ b/src/category.c @@ -69,12 +69,12 @@ those categories. */) if (STRING_MULTIBYTE (categories)) error ("Multibyte string in make-category-set"); - len = XSTRING (categories)->size; + len = SCHARS (categories); while (--len >= 0) { Lisp_Object category; - XSETFASTINT (category, XSTRING (categories)->data[len]); + XSETFASTINT (category, SREF (categories, len)); CHECK_CATEGORY (category); SET_CATEGORY_SET (val, category, Qt); } diff --git a/src/ccl.c b/src/ccl.c index 18fcad40328..d85045252b8 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -2198,12 +2198,12 @@ See the documentation of `define-ccl-program' for the detail of CCL program. */ if (ccl.ic < i && i < ccl.size) ccl.ic = i; } - outbufsize = STRING_BYTES (XSTRING (str)) * ccl.buf_magnification + 256; + outbufsize = SBYTES (str) * ccl.buf_magnification + 256; outbuf = (char *) xmalloc (outbufsize); ccl.last_block = NILP (contin); ccl.multibyte = STRING_MULTIBYTE (str); - produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf, - STRING_BYTES (XSTRING (str)), outbufsize, (int *) 0); + produced = ccl_driver (&ccl, SDATA (str), outbuf, + SBYTES (str), outbufsize, (int *) 0); for (i = 0; i < 8; i++) XSET (AREF (status, i), Lisp_Int, ccl.reg[i]); XSETINT (AREF (status, 8), ccl.ic); diff --git a/src/charset.c b/src/charset.c index 493c50545ac..191bef85a95 100644 --- a/src/charset.c +++ b/src/charset.c @@ -700,14 +700,14 @@ DESCRIPTION (string) is the description string of the charset. */) || !STRINGP (vec[7]) || !STRINGP (vec[8])) error ("Invalid info-vector argument for defining charset %s", - XSTRING (SYMBOL_NAME (charset_symbol))->data); + SDATA (SYMBOL_NAME (charset_symbol))); if (NILP (charset_id)) { charset_id = get_new_private_charset_id (XINT (vec[0]), XINT (vec[2])); if (XINT (charset_id) == 0) error ("There's no room for a new private charset %s", - XSTRING (SYMBOL_NAME (charset_symbol))->data); + SDATA (SYMBOL_NAME (charset_symbol))); } update_charset_table (charset_id, vec[0], vec[1], vec[2], vec[3], @@ -779,7 +779,7 @@ CHARSET should be defined by `defined-charset' in advance. */) if (XINT (final_char) < '0' || XFASTINT (final_char) > '~') error ("Invalid FINAL-CHAR %c, it should be `0'..`~'", XINT (chars)); if ((charset = get_charset_id (charset_symbol)) < 0) - error ("Invalid charset %s", XSTRING (SYMBOL_NAME (charset_symbol))->data); + error ("Invalid charset %s", SDATA (SYMBOL_NAME (charset_symbol))); ISO_CHARSET_TABLE (dimension, chars, final_char) = charset; return Qnil; @@ -943,8 +943,8 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) CHECK_STRING (str); bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); - find_charset_in_text (XSTRING (str)->data, XSTRING (str)->size, - STRING_BYTES (XSTRING (str)), charsets, table); + find_charset_in_text (SDATA (str), SCHARS (str), + SBYTES (str), charsets, table); val = Qnil; if (charsets[1]) @@ -1335,9 +1335,9 @@ lisp_string_width (string, precision, nchars, nbytes) Lisp_Object string; int precision, *nchars, *nbytes; { - int len = XSTRING (string)->size; - int len_byte = STRING_BYTES (XSTRING (string)); - unsigned char *str = XSTRING (string)->data; + int len = SCHARS (string); + int len_byte = SBYTES (string); + unsigned char *str = SDATA (string); int i = 0, i_byte = 0; int width = 0; struct Lisp_Char_Table *dp = buffer_display_table (); diff --git a/src/charset.h b/src/charset.h index 42ab2308d68..62383e603ba 100644 --- a/src/charset.h +++ b/src/charset.h @@ -573,7 +573,7 @@ if (1) \ CHARIDX++; \ if (STRING_MULTIBYTE (STRING)) \ { \ - unsigned char *ptr = &XSTRING (STRING)->data[BYTEIDX]; \ + unsigned char *ptr = &SREF (STRING, BYTEIDX); \ int space_left = XSTRING (STRING)->size_byte - BYTEIDX; \ int actual_len; \ \ @@ -581,7 +581,7 @@ if (1) \ BYTEIDX += actual_len; \ } \ else \ - OUTPUT = XSTRING (STRING)->data[BYTEIDX++]; \ + OUTPUT = SREF (STRING, BYTEIDX++); \ } \ else @@ -590,7 +590,7 @@ else #define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \ if (1) \ { \ - unsigned char *fetch_string_char_ptr = &XSTRING (STRING)->data[BYTEIDX]; \ + unsigned char *fetch_string_char_ptr = &SREF (STRING, BYTEIDX); \ int fetch_string_char_space_left = XSTRING (STRING)->size_byte - BYTEIDX; \ int actual_len; \ \ diff --git a/src/coding.c b/src/coding.c index af23b636764..0afe0b3ac42 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5224,7 +5224,7 @@ coding_save_composition (coding, from, to, obj) else if (VECTORP (val) || STRINGP (val)) { int len = (VECTORP (val) - ? XVECTOR (val)->size : XSTRING (val)->size); + ? XVECTOR (val)->size : SCHARS (val)); int i; for (i = 0; i < len; i++) { @@ -5832,7 +5832,7 @@ run_pre_post_conversion_on_str (str, coding, encodep) buf->enable_multibyte_characters = multibyte ? Qt : Qnil; insert_from_string (str, 0, 0, - XSTRING (str)->size, STRING_BYTES (XSTRING (str)), 0); + SCHARS (str), SBYTES (str), 0); UNGCPRO; inhibit_pre_post_conversion = 1; if (encodep) @@ -5864,7 +5864,7 @@ decode_coding_string (str, coding, nocopy) int consumed, consumed_char, produced, produced_char; from = 0; - to_byte = STRING_BYTES (XSTRING (str)); + to_byte = SBYTES (str); saved_coding_symbol = coding->symbol; coding->src_multibyte = STRING_MULTIBYTE (str); @@ -5874,7 +5874,7 @@ decode_coding_string (str, coding, nocopy) /* See the comments in code_convert_region. */ if (coding->type == coding_type_undecided) { - detect_coding (coding, XSTRING (str)->data, to_byte); + detect_coding (coding, SDATA (str), to_byte); if (coding->type == coding_type_undecided) { coding->type = coding_type_emacs_mule; @@ -5889,7 +5889,7 @@ decode_coding_string (str, coding, nocopy) && coding->type != coding_type_ccl) { saved_coding_symbol = coding->symbol; - detect_eol (coding, XSTRING (str)->data, to_byte); + detect_eol (coding, SDATA (str), to_byte); if (coding->eol_type == CODING_EOL_UNDECIDED) coding->eol_type = CODING_EOL_LF; /* We had better recover the original eol format if we @@ -5908,7 +5908,7 @@ decode_coding_string (str, coding, nocopy) { /* Decoding routines expect the source text to be unibyte. */ str = Fstring_as_unibyte (str); - to_byte = STRING_BYTES (XSTRING (str)); + to_byte = SBYTES (str); nocopy = 1; coding->src_multibyte = 0; } @@ -5916,24 +5916,24 @@ decode_coding_string (str, coding, nocopy) /* Try to skip the heading and tailing ASCIIs. */ if (require_decoding && coding->type != coding_type_ccl) { - SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data, + SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), 0); if (from == to_byte) require_decoding = 0; - shrinked_bytes = from + (STRING_BYTES (XSTRING (str)) - to_byte); + shrinked_bytes = from + (SBYTES (str) - to_byte); } if (!require_decoding) { - coding->consumed = STRING_BYTES (XSTRING (str)); - coding->consumed_char = XSTRING (str)->size; + coding->consumed = SBYTES (str); + coding->consumed_char = SCHARS (str); if (coding->dst_multibyte) { str = Fstring_as_multibyte (str); nocopy = 1; } - coding->produced = STRING_BYTES (XSTRING (str)); - coding->produced_char = XSTRING (str)->size; + coding->produced = SBYTES (str); + coding->produced_char = SCHARS (str); return (nocopy ? str : Fcopy_sequence (str)); } @@ -5945,7 +5945,7 @@ decode_coding_string (str, coding, nocopy) consumed = consumed_char = produced = produced_char = 0; while (1) { - result = decode_coding (coding, XSTRING (str)->data + from + consumed, + result = decode_coding (coding, SDATA (str) + from + consumed, buf.data + produced, to_byte - from - consumed, buf.size - produced); consumed += coding->consumed; @@ -6014,11 +6014,11 @@ decode_coding_string (str, coding, nocopy) else newstr = make_uninit_string (produced + shrinked_bytes); if (from > 0) - bcopy (XSTRING (str)->data, XSTRING (newstr)->data, from); - bcopy (buf.data, XSTRING (newstr)->data + from, produced); + bcopy (SDATA (str), SDATA (newstr), from); + bcopy (buf.data, SDATA (newstr) + from, produced); if (shrinked_bytes > from) - bcopy (XSTRING (str)->data + to_byte, - XSTRING (newstr)->data + from + produced, + bcopy (SDATA (str) + to_byte, + SDATA (newstr) + from + produced, shrinked_bytes - from); free_conversion_buffer (&buf); @@ -6052,8 +6052,8 @@ encode_coding_string (str, coding, nocopy) str = run_pre_post_conversion_on_str (str, coding, 1); from = 0; - to = XSTRING (str)->size; - to_byte = STRING_BYTES (XSTRING (str)); + to = SCHARS (str); + to_byte = SBYTES (str); /* Encoding routines determine the multibyteness of the source text by coding->src_multibyte. */ @@ -6061,15 +6061,15 @@ encode_coding_string (str, coding, nocopy) coding->dst_multibyte = 0; if (! CODING_REQUIRE_ENCODING (coding)) { - coding->consumed = STRING_BYTES (XSTRING (str)); - coding->consumed_char = XSTRING (str)->size; + coding->consumed = SBYTES (str); + coding->consumed_char = SCHARS (str); if (STRING_MULTIBYTE (str)) { str = Fstring_as_unibyte (str); nocopy = 1; } - coding->produced = STRING_BYTES (XSTRING (str)); - coding->produced_char = XSTRING (str)->size; + coding->produced = SBYTES (str); + coding->produced_char = SCHARS (str); return (nocopy ? str : Fcopy_sequence (str)); } @@ -6079,11 +6079,11 @@ encode_coding_string (str, coding, nocopy) /* Try to skip the heading and tailing ASCIIs. */ if (coding->type != coding_type_ccl) { - SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data, + SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), 1); if (from == to_byte) return (nocopy ? str : Fcopy_sequence (str)); - shrinked_bytes = from + (STRING_BYTES (XSTRING (str)) - to_byte); + shrinked_bytes = from + (SBYTES (str) - to_byte); } len = encoding_buffer_size (coding, to_byte - from); @@ -6092,7 +6092,7 @@ encode_coding_string (str, coding, nocopy) consumed = consumed_char = produced = produced_char = 0; while (1) { - result = encode_coding (coding, XSTRING (str)->data + from + consumed, + result = encode_coding (coding, SDATA (str) + from + consumed, buf.data + produced, to_byte - from - consumed, buf.size - produced); consumed += coding->consumed; @@ -6114,11 +6114,11 @@ encode_coding_string (str, coding, nocopy) newstr = make_uninit_string (produced + shrinked_bytes); if (from > 0) - bcopy (XSTRING (str)->data, XSTRING (newstr)->data, from); - bcopy (buf.data, XSTRING (newstr)->data + from, produced); + bcopy (SDATA (str), SDATA (newstr), from); + bcopy (buf.data, SDATA (newstr) + from, produced); if (shrinked_bytes > from) - bcopy (XSTRING (str)->data + to_byte, - XSTRING (newstr)->data + from + produced, + bcopy (SDATA (str) + to_byte, + SDATA (newstr) + from + produced, shrinked_bytes - from); free_conversion_buffer (&buf); @@ -6160,7 +6160,7 @@ DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system, val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, Qt, Qnil, Qcoding_system_history, Qnil, Qnil); } - while (XSTRING (val)->size == 0); + while (SCHARS (val) == 0); return (Fintern (val, Qnil)); } @@ -6176,7 +6176,7 @@ If the user enters null input, return second argument DEFAULT-CODING-SYSTEM. */ val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, Qt, Qnil, Qcoding_system_history, default_coding_system, Qnil); - return (XSTRING (val)->size == 0 ? Qnil : Fintern (val, Qnil)); + return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil)); } DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system, @@ -6318,12 +6318,12 @@ highest priority. */) { CHECK_STRING (string); - return detect_coding_system (XSTRING (string)->data, + return detect_coding_system (SDATA (string), /* "+ 1" is to include the anchor byte `\0'. With this, code detectors can handle the tailing bytes more accurately. */ - STRING_BYTES (XSTRING (string)) + 1, + SBYTES (string) + 1, !NILP (highest), STRING_MULTIBYTE (string)); } @@ -6420,9 +6420,9 @@ DEFUN ("find-coding-systems-region-internal", { if (!STRING_MULTIBYTE (start)) return Qt; - p1 = XSTRING (start)->data, p1end = p1 + STRING_BYTES (XSTRING (start)); + p1 = SDATA (start), p1end = p1 + SBYTES (start); p2 = p2end = p1end; - if (XSTRING (start)->size != STRING_BYTES (XSTRING (start))) + if (SCHARS (start) != SBYTES (start)) non_ascii_p = 1; } else @@ -6508,7 +6508,7 @@ code_convert_region1 (start, end, coding_system, encodep) return make_number (to - from); if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) - error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); + error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); coding.mode |= CODING_MODE_LAST_BLOCK; coding.src_multibyte = coding.dst_multibyte @@ -6563,7 +6563,7 @@ code_convert_string1 (string, coding_system, nocopy, encodep) return (NILP (nocopy) ? Fcopy_sequence (string) : string); if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) - error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); + error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); coding.mode |= CODING_MODE_LAST_BLOCK; string = (encodep @@ -6622,7 +6622,7 @@ code_convert_string_norecord (string, coding_system, encodep) return string; if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) - error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); + error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); coding.composing = COMPOSITION_DISABLED; coding.mode |= CODING_MODE_LAST_BLOCK; @@ -6867,7 +6867,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS ...) */) error ("Invalid first argument"); if (nargs < 1 + XINT (target_idx)) error ("Too few arguments for operation: %s", - XSTRING (SYMBOL_NAME (operation))->data); + SDATA (SYMBOL_NAME (operation))); target = args[XINT (target_idx) + 1]; if (!(STRINGP (target) || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) @@ -7430,7 +7430,7 @@ emacs_strerror (error_number) Lisp_Object dec = code_convert_string_norecord (build_string (str), Vlocale_coding_system, 0); - str = (char *) XSTRING (dec)->data; + str = (char *) SDATA (dec); } return str; diff --git a/src/composite.c b/src/composite.c index 8a8406587e2..1b40810a3aa 100644 --- a/src/composite.c +++ b/src/composite.c @@ -615,8 +615,8 @@ compose_chars_in_text (start, end, string) count = SPECPDL_INDEX (); GCPRO1 (string); stop = end; - ptr = XSTRING (string)->data + string_char_to_byte (string, start); - pend = ptr + STRING_BYTES (XSTRING (string)); + ptr = SDATA (string) + string_char_to_byte (string, start); + pend = ptr + SBYTES (string); } else { @@ -650,7 +650,7 @@ compose_chars_in_text (start, end, string) break; stop = end; if (STRINGP (string)) - ptr = XSTRING (string)->data + string_char_to_byte (string, start); + ptr = SDATA (string) + string_char_to_byte (string, start); else ptr = CHAR_POS_ADDR (start); } @@ -680,7 +680,7 @@ compose_chars_in_text (start, end, string) { start += XINT (val); if (STRINGP (string)) - ptr = XSTRING (string)->data + string_char_to_byte (string, start); + ptr = SDATA (string) + string_char_to_byte (string, start); else ptr = CHAR_POS_ADDR (start); } @@ -746,7 +746,7 @@ for the composition. See `compose-string' for more detail. */) if (XINT (start) < 0 || XINT (start) > XINT (end) - || XINT (end) > XSTRING (string)->size) + || XINT (end) > SCHARS (string)) args_out_of_range (start, end); compose_text (XINT (start), XINT (end), components, mod_func, string); @@ -779,7 +779,7 @@ See `find-composition' for more detail. */) if (!NILP (string)) { CHECK_STRING (string); - if (XINT (pos) < 0 || XINT (pos) > XSTRING (string)->size) + if (XINT (pos) < 0 || XINT (pos) > SCHARS (string)) args_out_of_range (string, pos); } else diff --git a/src/data.c b/src/data.c index f2c13dd9749..700395808cc 100644 --- a/src/data.c +++ b/src/data.c @@ -311,7 +311,7 @@ interned in the initial obarray. */) Lisp_Object object; { if (SYMBOLP (object) - && XSTRING (SYMBOL_NAME (object))->data[0] == ':' + && SREF (SYMBOL_NAME (object), 0) == ':' && SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (object)) return Qt; return Qnil; @@ -873,7 +873,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf) *XINTFWD (valcontents)->intvar = XINT (newval); if (*XINTFWD (valcontents)->intvar != XINT (newval)) error ("Value out of range for variable `%s'", - XSTRING (SYMBOL_NAME (symbol))->data); + SDATA (SYMBOL_NAME (symbol))); break; case Lisp_Misc_Boolfwd: @@ -891,7 +891,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf) type = PER_BUFFER_TYPE (offset); if (XINT (type) == -1) - error ("Variable %s is read-only", XSTRING (SYMBOL_NAME (symbol))->data); + error ("Variable %s is read-only", SDATA (SYMBOL_NAME (symbol))); if (! NILP (type) && ! NILP (newval) && XTYPE (newval) != XINT (type)) @@ -1447,7 +1447,7 @@ The function `default-value' gets the default value and `set-default' sets it. valcontents = SYMBOL_VALUE (variable); if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) - error ("Symbol %s may not be buffer-local", XSTRING (SYMBOL_NAME (variable))->data); + error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) return variable; @@ -1500,7 +1500,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) valcontents = SYMBOL_VALUE (variable); if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) - error ("Symbol %s may not be buffer-local", XSTRING (SYMBOL_NAME (variable))->data); + error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) { @@ -1643,7 +1643,7 @@ See `modify-frame-parameters'. */) valcontents = SYMBOL_VALUE (variable); if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents) || BUFFER_OBJFWDP (valcontents)) - error ("Symbol %s may not be frame-local", XSTRING (SYMBOL_NAME (variable))->data); + error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable))); if (BUFFER_LOCAL_VALUEP (valcontents) || SOME_BUFFER_LOCAL_VALUEP (valcontents)) @@ -1827,14 +1827,14 @@ or a byte-code object. IDX starts at 0. */) { int c, idxval_byte; - if (idxval < 0 || idxval >= XSTRING (array)->size) + if (idxval < 0 || idxval >= SCHARS (array)) args_out_of_range (array, idx); if (! STRING_MULTIBYTE (array)) - return make_number ((unsigned char) XSTRING (array)->data[idxval]); + return make_number ((unsigned char) SREF (array, idxval)); idxval_byte = string_char_to_byte (array, idxval); - c = STRING_CHAR (&XSTRING (array)->data[idxval_byte], - STRING_BYTES (XSTRING (array)) - idxval_byte); + c = STRING_CHAR (&SREF (array, idxval_byte), + SBYTES (array) - idxval_byte); return make_number (c); } else if (BOOL_VECTOR_P (array)) @@ -2026,29 +2026,29 @@ IDX starts at 0. */) int idxval_byte, prev_bytes, new_bytes; unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; - if (idxval < 0 || idxval >= XSTRING (array)->size) + if (idxval < 0 || idxval >= SCHARS (array)) args_out_of_range (array, idx); CHECK_NUMBER (newelt); idxval_byte = string_char_to_byte (array, idxval); - p1 = &XSTRING (array)->data[idxval_byte]; + p1 = &SREF (array, idxval_byte); PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes); new_bytes = CHAR_STRING (XINT (newelt), p0); if (prev_bytes != new_bytes) { /* We must relocate the string data. */ - int nchars = XSTRING (array)->size; - int nbytes = STRING_BYTES (XSTRING (array)); + int nchars = SCHARS (array); + int nbytes = SBYTES (array); unsigned char *str; str = (nbytes <= MAX_ALLOCA ? (unsigned char *) alloca (nbytes) : (unsigned char *) xmalloc (nbytes)); - bcopy (XSTRING (array)->data, str, nbytes); + bcopy (SDATA (array), str, nbytes); allocate_string_data (XSTRING (array), nchars, nbytes + new_bytes - prev_bytes); - bcopy (str, XSTRING (array)->data, idxval_byte); - p1 = XSTRING (array)->data + idxval_byte; + bcopy (str, SDATA (array), idxval_byte); + p1 = SDATA (array) + idxval_byte; bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes, nbytes - (idxval_byte + prev_bytes)); if (nbytes > MAX_ALLOCA) @@ -2060,36 +2060,36 @@ IDX starts at 0. */) } else { - if (idxval < 0 || idxval >= XSTRING (array)->size) + if (idxval < 0 || idxval >= SCHARS (array)) args_out_of_range (array, idx); CHECK_NUMBER (newelt); if (XINT (newelt) < 0 || SINGLE_BYTE_CHAR_P (XINT (newelt))) - XSTRING (array)->data[idxval] = XINT (newelt); + SREF (array, idxval) = XINT (newelt); else { /* We must relocate the string data while converting it to multibyte. */ int idxval_byte, prev_bytes, new_bytes; unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; - unsigned char *origstr = XSTRING (array)->data, *str; + unsigned char *origstr = SDATA (array), *str; int nchars, nbytes; - nchars = XSTRING (array)->size; + nchars = SCHARS (array); nbytes = idxval_byte = count_size_as_multibyte (origstr, idxval); nbytes += count_size_as_multibyte (origstr + idxval, nchars - idxval); str = (nbytes <= MAX_ALLOCA ? (unsigned char *) alloca (nbytes) : (unsigned char *) xmalloc (nbytes)); - copy_text (XSTRING (array)->data, str, nchars, 0, 1); + copy_text (SDATA (array), str, nchars, 0, 1); PARSE_MULTIBYTE_SEQ (str + idxval_byte, nbytes - idxval_byte, prev_bytes); new_bytes = CHAR_STRING (XINT (newelt), p0); allocate_string_data (XSTRING (array), nchars, nbytes + new_bytes - prev_bytes); - bcopy (str, XSTRING (array)->data, idxval_byte); - p1 = XSTRING (array)->data + idxval_byte; + bcopy (str, SDATA (array), idxval_byte); + p1 = SDATA (array) + idxval_byte; while (new_bytes--) *p1++ = *p0++; bcopy (str + idxval_byte + prev_bytes, p1, @@ -2339,7 +2339,7 @@ If the base used is not 10, floating point is not recognized. */) /* Skip any whitespace at the front of the number. Some versions of atoi do this anyway, so we might as well make Emacs lisp consistent. */ - p = XSTRING (string)->data; + p = SDATA (string); while (*p == ' ' || *p == '\t') p++; diff --git a/src/dired.c b/src/dired.c index 0a119afb5eb..ec1686ffe14 100644 --- a/src/dired.c +++ b/src/dired.c @@ -188,7 +188,7 @@ directory_files_internal (directory, full, match, nosort, attrs) unwind_protect to do so would be a pain. */ retry: - d = opendir (XSTRING (dirfilename)->data); + d = opendir (SDATA (dirfilename)); if (d == NULL) report_file_error ("Opening directory", Fcons (directory, Qnil)); @@ -199,13 +199,13 @@ directory_files_internal (directory, full, match, nosort, attrs) Fcons (make_number (((unsigned long) d) >> 16), make_number (((unsigned long) d) & 0xffff))); - directory_nbytes = STRING_BYTES (XSTRING (directory)); + directory_nbytes = SBYTES (directory); re_match_object = Qt; /* Decide whether we need to add a directory separator. */ #ifndef VMS if (directory_nbytes == 0 - || !IS_ANY_SEP (XSTRING (directory)->data[directory_nbytes - 1])) + || !IS_ANY_SEP (SREF (directory, directory_nbytes - 1))) needsep = 1; #endif /* not VMS */ @@ -237,7 +237,7 @@ directory_files_internal (directory, full, match, nosort, attrs) /* Note: ENCODE_FILE can GC; it should protect its argument, though. */ name = DECODE_FILE (name); - len = STRING_BYTES (XSTRING (name)); + len = SBYTES (name); /* Now that we have unwind_protect in place, we might as well allow matching to be interrupted. */ @@ -245,7 +245,7 @@ directory_files_internal (directory, full, match, nosort, attrs) QUIT; if (NILP (match) - || (0 <= re_search (bufp, XSTRING (name)->data, len, 0, len, 0))) + || (0 <= re_search (bufp, SDATA (name), len, 0, len, 0))) wanted = 1; immediate_quit = 0; @@ -259,25 +259,25 @@ directory_files_internal (directory, full, match, nosort, attrs) int nchars; fullname = make_uninit_multibyte_string (nbytes, nbytes); - bcopy (XSTRING (directory)->data, XSTRING (fullname)->data, + bcopy (SDATA (directory), SDATA (fullname), directory_nbytes); if (needsep) - XSTRING (fullname)->data[directory_nbytes] = DIRECTORY_SEP; + SREF (fullname, directory_nbytes) = DIRECTORY_SEP; - bcopy (XSTRING (name)->data, - XSTRING (fullname)->data + directory_nbytes + needsep, + bcopy (SDATA (name), + SDATA (fullname) + directory_nbytes + needsep, len); - nchars = chars_in_text (XSTRING (fullname)->data, nbytes); + nchars = chars_in_text (SDATA (fullname), nbytes); /* Some bug somewhere. */ if (nchars > nbytes) abort (); - XSTRING (fullname)->size = nchars; + SCHARS (fullname) = nchars; if (nchars == nbytes) - SET_STRING_BYTES (XSTRING (fullname), -1); + STRING_SET_UNIBYTE (fullname); finalname = fullname; } @@ -519,7 +519,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++) { - d = opendir (XSTRING (Fdirectory_file_name (encoded_dir))->data); + d = opendir (SDATA (Fdirectory_file_name (encoded_dir))); if (!d) report_file_error ("Opening directory", Fcons (dirname, Qnil)); @@ -542,9 +542,9 @@ file_name_completion (file, dirname, all_flag, ver_flag) if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) goto quit; if (! DIRENTRY_NONEMPTY (dp) - || len < XSTRING (encoded_file)->size - || 0 <= scmp (dp->d_name, XSTRING (encoded_file)->data, - XSTRING (encoded_file)->size)) + || len < SCHARS (encoded_file) + || 0 <= scmp (dp->d_name, SDATA (encoded_file), + SCHARS (encoded_file))) continue; if (file_name_completion_stat (encoded_dir, dp, &st) < 0) @@ -561,7 +561,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) actually in the way in a directory contains only one file. */ if (!passcount && TRIVIAL_DIRECTORY_ENTRY (dp->d_name)) continue; - if (!passcount && len > XSTRING (encoded_file)->size) + if (!passcount && len > SCHARS (encoded_file)) /* Ignore directories if they match an element of completion-ignored-extensions which ends in a slash. */ for (tem = Vcompletion_ignored_extensions; @@ -575,10 +575,10 @@ file_name_completion (file, dirname, all_flag, ver_flag) /* Need to encode ELT, since scmp compares unibyte strings only. */ elt = ENCODE_FILE (elt); - elt_len = XSTRING (elt)->size - 1; /* -1 for trailing / */ + elt_len = SCHARS (elt) - 1; /* -1 for trailing / */ if (elt_len <= 0) continue; - p1 = XSTRING (elt)->data; + p1 = SDATA (elt); if (p1[elt_len] != '/') continue; skip = len - elt_len; @@ -594,7 +594,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) { /* Compare extensions-to-be-ignored against end of this file name */ /* if name is not an exact match against specified string */ - if (!passcount && len > XSTRING (encoded_file)->size) + if (!passcount && len > SCHARS (encoded_file)) /* and exit this for loop if a match is found */ for (tem = Vcompletion_ignored_extensions; CONSP (tem); tem = XCDR (tem)) @@ -604,12 +604,12 @@ file_name_completion (file, dirname, all_flag, ver_flag) /* Need to encode ELT, since scmp compares unibyte strings only. */ elt = ENCODE_FILE (elt); - skip = len - XSTRING (elt)->size; + skip = len - SCHARS (elt); if (skip < 0) continue; if (0 <= scmp (dp->d_name + skip, - XSTRING (elt)->data, - XSTRING (elt)->size)) + SDATA (elt), + SCHARS (elt))) continue; break; } @@ -661,13 +661,13 @@ file_name_completion (file, dirname, all_flag, ver_flag) else { bestmatch = name; - bestmatchsize = XSTRING (name)->size; + bestmatchsize = SCHARS (name); } } else { compare = min (bestmatchsize, len); - p1 = XSTRING (bestmatch)->data; + p1 = SDATA (bestmatch); p2 = (unsigned char *) dp->d_name; matchsize = scmp(p1, p2, compare); if (matchsize < 0) @@ -682,7 +682,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) but BESTMATCH is not (it is too long). */ if ((matchsize == len && matchsize + !!directoryp - < XSTRING (bestmatch)->size) + < SCHARS (bestmatch)) || /* If there is no exact match ignoring case, prefer a match that does not change the case @@ -695,9 +695,9 @@ file_name_completion (file, dirname, all_flag, ver_flag) (((matchsize == len) == (matchsize + !!directoryp - == XSTRING (bestmatch)->size)) - && !bcmp (p2, XSTRING (encoded_file)->data, XSTRING (encoded_file)->size) - && bcmp (p1, XSTRING (encoded_file)->data, XSTRING (encoded_file)->size))) + == SCHARS (bestmatch))) + && !bcmp (p2, SDATA (encoded_file), SCHARS (encoded_file)) + && bcmp (p1, SDATA (encoded_file), SCHARS (encoded_file)))) { bestmatch = make_string (dp->d_name, len); if (directoryp) @@ -727,7 +727,7 @@ file_name_completion (file, dirname, all_flag, ver_flag) bestmatch = DECODE_FILE (bestmatch); return bestmatch; } - if (matchcount == 1 && bestmatchsize == XSTRING (file)->size) + if (matchcount == 1 && bestmatchsize == SCHARS (file)) return Qt; bestmatch = Fsubstring (bestmatch, make_number (0), make_number (bestmatchsize)); @@ -777,7 +777,7 @@ file_name_completion_stat (dirname, dp, st_addr) struct stat *st_addr; { int len = NAMLEN (dp); - int pos = XSTRING (dirname)->size; + int pos = SCHARS (dirname); int value; char *fullname = (char *) alloca (len + pos + 2); @@ -794,7 +794,7 @@ file_name_completion_stat (dirname, dp, st_addr) #endif /* __DJGPP__ > 1 */ #endif /* MSDOS */ - bcopy (XSTRING (dirname)->data, fullname, pos); + bcopy (SDATA (dirname), fullname, pos); #ifndef VMS if (!IS_DIRECTORY_SEP (fullname[pos - 1])) fullname[pos++] = DIRECTORY_SEP; @@ -847,7 +847,7 @@ Returns nil if the file cannot be opened or if there is no version limit. */) filename = Fexpand_file_name (filename, Qnil); fab = cc$rms_fab; xabfhc = cc$rms_xabfhc; - fab.fab$l_fna = XSTRING (filename)->data; + fab.fab$l_fna = SDATA (filename); fab.fab$b_fns = strlen (fab.fab$l_fna); fab.fab$l_xab = (char *) &xabfhc; status = sys$open (&fab, 0, 0); @@ -916,7 +916,7 @@ If file does not exist, returns nil. */) encoded = ENCODE_FILE (filename); - if (lstat (XSTRING (encoded)->data, &s) < 0) + if (lstat (SDATA (encoded), &s) < 0) return Qnil; switch (s.st_mode & S_IFMT) @@ -946,7 +946,7 @@ If file does not exist, returns nil. */) dirname = Ffile_name_directory (filename); if (! NILP (dirname)) encoded = ENCODE_FILE (dirname); - if (! NILP (dirname) && stat (XSTRING (encoded)->data, &sdir) == 0) + if (! NILP (dirname) && stat (SDATA (encoded), &sdir) == 0) values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil; else /* if we can't tell, assume worst */ values[9] = Qt; diff --git a/src/dispnew.c b/src/dispnew.c index 59cc06b19ea..1467fd6eba7 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -379,7 +379,7 @@ add_window_display_history (w, msg, paused_p) w, ((BUFFERP (w->buffer) && STRINGP (XBUFFER (w->buffer)->name)) - ? (char *) XSTRING (XBUFFER (w->buffer)->name)->data + ? (char *) SDATA (XBUFFER (w->buffer)->name) : "???"), paused_p ? " ***paused***" : ""); strcat (buf, msg); @@ -6058,7 +6058,7 @@ FILE = nil means just close any termscript file currently open. */) if (! NILP (file)) { file = Fexpand_file_name (file, Qnil); - termscript = fopen (XSTRING (file)->data, "w"); + termscript = fopen (SDATA (file), "w"); if (termscript == 0) report_file_error ("Opening termscript", Fcons (file, Qnil)); } @@ -6075,11 +6075,11 @@ Control characters in STRING will have terminal-dependent effects. */) { /* ??? Perhaps we should do something special for multibyte strings here. */ CHECK_STRING (string); - fwrite (XSTRING (string)->data, 1, STRING_BYTES (XSTRING (string)), stdout); + fwrite (SDATA (string), 1, SBYTES (string), stdout); fflush (stdout); if (termscript) { - fwrite (XSTRING (string)->data, 1, STRING_BYTES (XSTRING (string)), + fwrite (SDATA (string), 1, SBYTES (string), termscript); fflush (termscript); } @@ -6330,7 +6330,7 @@ the current state. */) { buf = XCDR (XCAR (tail)); /* Ignore buffers that aren't included in buffer lists. */ - if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') + if (SREF (XBUFFER (buf)->name, 0) == ' ') continue; if (!EQ (*vecp++, buf)) goto changed; @@ -6364,7 +6364,7 @@ the current state. */) { buf = XCDR (XCAR (tail)); /* Ignore buffers that aren't included in buffer lists. */ - if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') + if (SREF (XBUFFER (buf)->name, 0) == ' ') continue; *vecp++ = buf; *vecp++ = XBUFFER (buf)->read_only; diff --git a/src/disptab.h b/src/disptab.h index 1fb6307a73a..526b1c4a9d3 100644 --- a/src/disptab.h +++ b/src/disptab.h @@ -90,8 +90,8 @@ extern Lisp_Object Vglyph_table; /* Assuming that GLYPH_SIMPLE_P (BASE, LEN, G) is 0, return the length and the address of the character-sequence used for outputting GLYPH G. */ -#define GLYPH_LENGTH(base,g) XSTRING (base[g])->size -#define GLYPH_STRING(base,g) XSTRING (base[g])->data +#define GLYPH_LENGTH(base,g) SCHARS (base[g]) +#define GLYPH_STRING(base,g) SDATA (base[g]) /* GLYPH for a space character. */ diff --git a/src/doc.c b/src/doc.c index 957c43d07b7..473ba911023 100644 --- a/src/doc.c +++ b/src/doc.c @@ -158,18 +158,18 @@ get_doc_string (filepos, unibyte, definition) tem = Ffile_name_absolute_p (file); if (NILP (tem)) { - minsize = XSTRING (Vdoc_directory)->size; + minsize = SCHARS (Vdoc_directory); /* sizeof ("../etc/") == 8 */ if (minsize < 8) minsize = 8; - name = (char *) alloca (minsize + XSTRING (file)->size + 8); - strcpy (name, XSTRING (Vdoc_directory)->data); - strcat (name, XSTRING (file)->data); + name = (char *) alloca (minsize + SCHARS (file) + 8); + strcpy (name, SDATA (Vdoc_directory)); + strcat (name, SDATA (file)); munge_doc_file_name (name); } else { - name = (char *) XSTRING (file)->data; + name = (char *) SDATA (file); } fd = emacs_open (name, O_RDONLY, 0); @@ -181,7 +181,7 @@ get_doc_string (filepos, unibyte, definition) /* Preparing to dump; DOC file is probably not installed. So check in ../etc. */ strcpy (name, "../etc/"); - strcat (name, XSTRING (file)->data); + strcat (name, SDATA (file)); munge_doc_file_name (name); fd = emacs_open (name, O_RDONLY, 0); @@ -590,17 +590,17 @@ the same file name is found in the `data-directory'. */) (0) #endif /* CANNOT_DUMP */ { - name = (char *) alloca (XSTRING (filename)->size + 14); + name = (char *) alloca (SCHARS (filename) + 14); strcpy (name, "../etc/"); } else { CHECK_STRING (Vdoc_directory); - name = (char *) alloca (XSTRING (filename)->size - + XSTRING (Vdoc_directory)->size + 1); - strcpy (name, XSTRING (Vdoc_directory)->data); + name = (char *) alloca (SCHARS (filename) + + SCHARS (Vdoc_directory) + 1); + strcpy (name, SDATA (Vdoc_directory)); } - strcat (name, XSTRING (filename)->data); /*** Add this line ***/ + strcat (name, SDATA (filename)); /*** Add this line ***/ #ifdef VMS #ifndef VMS4_4 /* For VMS versions with limited file name syntax, @@ -722,11 +722,11 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int if (NILP (keymap)) keymap = Voverriding_local_map; - bsize = STRING_BYTES (XSTRING (string)); + bsize = SBYTES (string); bufp = buf = (unsigned char *) xmalloc (bsize); - strp = (unsigned char *) XSTRING (string)->data; - while (strp < XSTRING (string)->data + STRING_BYTES (XSTRING (string))) + strp = (unsigned char *) SDATA (string); + while (strp < SDATA (string) + SBYTES (string)) { if (strp[0] == '\\' && strp[1] == '=') { @@ -737,7 +737,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int if (multibyte) { int len; - int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp; + int maxlen = SDATA (string) + SBYTES (string) - strp; STRING_CHAR_AND_LENGTH (strp, maxlen, len); if (len == 1) @@ -759,10 +759,10 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int changed = 1; strp += 2; /* skip \[ */ start = strp; - start_idx = start - XSTRING (string)->data; + start_idx = start - SDATA (string); - while ((strp - (unsigned char *) XSTRING (string)->data - < STRING_BYTES (XSTRING (string))) + while ((strp - (unsigned char *) SDATA (string) + < SBYTES (string)) && *strp != ']') strp++; length_byte = strp - start; @@ -770,14 +770,14 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int strp++; /* skip ] */ /* Save STRP in IDX. */ - idx = strp - (unsigned char *) XSTRING (string)->data; + idx = strp - (unsigned char *) SDATA (string); tem = Fintern (make_string (start, length_byte), Qnil); /* Note the Fwhere_is_internal can GC, so we have to take relocation of string contents into account. */ tem = Fwhere_is_internal (tem, keymap, Qt, Qnil, Qnil); - strp = XSTRING (string)->data + idx; - start = XSTRING (string)->data + start_idx; + strp = SDATA (string) + idx; + start = SDATA (string) + start_idx; /* Disregard menu bar bindings; it is positively annoying to mention them when there's no menu bar, and it isn't terribly @@ -819,10 +819,10 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int changed = 1; strp += 2; /* skip \{ or \< */ start = strp; - start_idx = start - XSTRING (string)->data; + start_idx = start - SDATA (string); - while ((strp - (unsigned char *) XSTRING (string)->data - < XSTRING (string)->size) + while ((strp - (unsigned char *) SDATA (string) + < SCHARS (string)) && *strp != '}' && *strp != '>') strp++; @@ -830,7 +830,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int strp++; /* skip } or > */ /* Save STRP in IDX. */ - idx = strp - (unsigned char *) XSTRING (string)->data; + idx = strp - (unsigned char *) SDATA (string); /* Get the value of the keymap in TEM, or nil if undefined. Do this while still in the user's current buffer @@ -844,8 +844,8 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int { tem = get_keymap (tem, 0, 1); /* Note that get_keymap can GC. */ - strp = XSTRING (string)->data + idx; - start = XSTRING (string)->data + start_idx; + strp = SDATA (string) + idx; + start = SDATA (string) + start_idx; } } @@ -858,8 +858,8 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int name = Fsymbol_name (name); insert_string ("\nUses keymap \""); insert_from_string (name, 0, 0, - XSTRING (name)->size, - STRING_BYTES (XSTRING (name)), 1); + SCHARS (name), + SBYTES (name), 1); insert_string ("\", which is not currently defined.\n"); if (start[-1] == '<') keymap = Qnil; } @@ -872,9 +872,9 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int set_buffer_internal (oldbuf); subst_string: - start = XSTRING (tem)->data; - length = XSTRING (tem)->size; - length_byte = STRING_BYTES (XSTRING (tem)); + start = SDATA (tem); + length = SCHARS (tem); + length_byte = SBYTES (tem); subst: { int offset = bufp - buf; @@ -884,7 +884,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int bufp += length_byte; nchars += length; /* Check STRING again in case gc relocated it. */ - strp = (unsigned char *) XSTRING (string)->data + idx; + strp = (unsigned char *) SDATA (string) + idx; } } else if (! multibyte) /* just copy other chars */ @@ -892,7 +892,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int else { int len; - int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp; + int maxlen = SDATA (string) + SBYTES (string) - strp; STRING_CHAR_AND_LENGTH (strp, maxlen, len); if (len == 1) diff --git a/src/dosfns.c b/src/dosfns.c index 428bde8e5d3..b2200ee507b 100644 --- a/src/dosfns.c +++ b/src/dosfns.c @@ -503,7 +503,7 @@ x_set_title (f, name) if (FRAME_MSDOS_P (f)) { BLOCK_INPUT; - w95_set_virtual_machine_title (XSTRING (name)->data); + w95_set_virtual_machine_title (SDATA (name)); UNBLOCK_INPUT; } } @@ -525,7 +525,7 @@ If the underlying system call fails, value is nil. */) filename = Fexpand_file_name (filename, Qnil); encoded = ENCODE_FILE (filename); - if (statfs (XSTRING (encoded)->data, &stfs)) + if (statfs (SDATA (encoded), &stfs)) value = Qnil; else value = list3 (make_float ((double) stfs.f_bsize * stfs.f_blocks), diff --git a/src/editfns.c b/src/editfns.c index 72da635a9b4..9c88d963eb3 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1202,7 +1202,7 @@ name, or nil if there is no such user. */) else if (NUMBERP (uid)) pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid)); else if (STRINGP (uid)) - pw = (struct passwd *) getpwnam (XSTRING (uid)->data); + pw = (struct passwd *) getpwnam (SDATA (uid)); else error ("Invalid UID specification"); @@ -1215,7 +1215,7 @@ name, or nil if there is no such user. */) full = make_string (p, q ? q - p : strlen (p)); #ifdef AMPERSAND_FULL_NAME - p = XSTRING (full)->data; + p = SDATA (full); q = (unsigned char *) index (p, '&'); /* Substitute the login name for the &, upcasing the first character. */ if (q) @@ -1224,10 +1224,10 @@ name, or nil if there is no such user. */) Lisp_Object login; login = Fuser_login_name (make_number (pw->pw_uid)); - r = (unsigned char *) alloca (strlen (p) + XSTRING (login)->size + 1); + r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1); bcopy (p, r, q - p); r[q - p] = 0; - strcat (r, XSTRING (login)->data); + strcat (r, SDATA (login)); r[q - p] = UPCASE (r[q - p]); strcat (r, q + 1); full = build_string (r); @@ -1250,7 +1250,7 @@ char * get_system_name () { if (STRINGP (Vsystem_name)) - return (char *) XSTRING (Vsystem_name)->data; + return (char *) SDATA (Vsystem_name); else return ""; } @@ -1479,7 +1479,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) Vlocale_coding_system, 1); /* This is probably enough. */ - size = STRING_BYTES (XSTRING (format_string)) * 6 + 50; + size = SBYTES (format_string) * 6 + 50; tm = ut ? gmtime (&value) : localtime (&value); if (! tm) @@ -1493,8 +1493,8 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) int result; buf[0] = '\1'; - result = emacs_memftimeu (buf, size, XSTRING (format_string)->data, - STRING_BYTES (XSTRING (format_string)), + 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,8 +1502,8 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) /* 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)), + SDATA (format_string), + SBYTES (format_string), tm, ut); size = result + 1; } @@ -1610,7 +1610,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) if (EQ (zone, Qt)) tzstring = "UTC0"; else if (STRINGP (zone)) - tzstring = (char *) XSTRING (zone)->data; + tzstring = (char *) SDATA (zone); else if (INTEGERP (zone)) { int abszone = abs (XINT (zone)); @@ -1788,7 +1788,7 @@ If TZ is t, use Universal Time. */) else { CHECK_STRING (tz); - tzstring = (char *) XSTRING (tz)->data; + tzstring = (char *) SDATA (tz); } set_time_zone_rule (tzstring); @@ -1934,8 +1934,8 @@ general_insert_function (insert_func, insert_from_string_func, else if (STRINGP (val)) { (*insert_from_string_func) (val, 0, 0, - XSTRING (val)->size, - STRING_BYTES (XSTRING (val)), + SCHARS (val), + SBYTES (val), inherit); } else @@ -2146,7 +2146,7 @@ make_buffer_string_both (start, start_byte, end, end_byte, props) 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, + bcopy (BYTE_POS_ADDR (start_byte), SDATA (result), end_byte - start_byte); /* If desired, update and copy the text properties. */ @@ -2659,8 +2659,8 @@ It returns the number of characters changed. */) validate_region (&start, &end); CHECK_STRING (table); - size = STRING_BYTES (XSTRING (table)); - tt = XSTRING (table)->data; + size = SBYTES (table); + tt = SDATA (table); pos_byte = CHAR_TO_BYTE (XINT (start)); stop = CHAR_TO_BYTE (XINT (end)); @@ -2929,7 +2929,7 @@ usage: (message STRING &rest ARGS) */) { register Lisp_Object val; val = Fformat (nargs, args); - message3 (val, STRING_BYTES (XSTRING (val)), STRING_MULTIBYTE (val)); + message3 (val, SBYTES (val), STRING_MULTIBYTE (val)); return val; } } @@ -2979,13 +2979,13 @@ usage: (message-box STRING &rest ARGS) */) message_text = (char *)xmalloc (80); message_length = 80; } - if (STRING_BYTES (XSTRING (val)) > message_length) + if (SBYTES (val) > message_length) { - message_length = STRING_BYTES (XSTRING (val)); + message_length = SBYTES (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)), + bcopy (SDATA (val), message_text, SBYTES (val)); + message2 (message_text, SBYTES (val), STRING_MULTIBYTE (val)); return val; } @@ -3058,7 +3058,7 @@ usage: (propertize STRING &rest PROPERTIES) */) } Fadd_text_properties (make_number (0), - make_number (XSTRING (string)->size), + make_number (SCHARS (string)), properties, string); RETURN_UNGCPRO (string); } @@ -3069,9 +3069,8 @@ usage: (propertize STRING &rest PROPERTIES) */) #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))) + ? 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,8 +3132,8 @@ usage: (format STRING &rest OBJECTS) */) 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])); + 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,7 +3254,7 @@ usage: (format STRING &rest OBJECTS) */) goto retry; } args[n] = Fchar_to_string (args[n]); - thissize = STRING_BYTES (XSTRING (args[n])); + thissize = SBYTES (args[n]); } } else if (FLOATP (args[n]) && *format != 's') @@ -3303,7 +3302,7 @@ usage: (format STRING &rest OBJECTS) */) n = 0; /* Scan the format and store result in BUF. */ - format = XSTRING (args[0])->data; + format = SDATA (args[0]); maybe_combine_byte = 0; while (format != end) { @@ -3353,13 +3352,13 @@ usage: (format STRING &rest OBJECTS) */) && multibyte && !ASCII_BYTE_P (*((unsigned char *) p - 1)) && STRING_MULTIBYTE (args[n]) - && !CHAR_HEAD_P (XSTRING (args[n])->data[0])) + && !CHAR_HEAD_P (SREF (args[n], 0))) maybe_combine_byte = 1; - nbytes = copy_text (XSTRING (args[n])->data, p, - STRING_BYTES (XSTRING (args[n])), + nbytes = copy_text (SDATA (args[n]), p, + SBYTES (args[n]), STRING_MULTIBYTE (args[n]), multibyte); p += nbytes; - nchars += XSTRING (args[n])->size; + nchars += SCHARS (args[n]); end = nchars; if (negative) @@ -3371,7 +3370,7 @@ usage: (format STRING &rest OBJECTS) */) /* If this argument has text properties, record where in the result string it appears. */ - if (XSTRING (args[n])->intervals) + if (STRING_INTERVALS (args[n])) { if (!info) { @@ -3450,19 +3449,19 @@ usage: (format STRING &rest OBJECTS) */) arguments has text properties, set up text properties of the result string. */ - if (XSTRING (args[0])->intervals || info) + 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 (XSTRING (args[0])->size); + 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 (XSTRING (val)->size); + new_len = make_number (SCHARS (val)); extend_property_ranges (props, len, new_len); add_text_properties_from_list (val, props, make_number (0)); } @@ -3472,7 +3471,7 @@ usage: (format STRING &rest OBJECTS) */) for (n = 1; n < nargs; ++n) if (info[n].end) { - len = make_number (XSTRING (args[n])->size); + 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); diff --git a/src/emacs.c b/src/emacs.c index f52af3e6fa6..4d03eab89b8 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -743,7 +743,7 @@ bug_reporting_address () if (!STRINGP(temp)) return REPORT_EMACS_BUG_ADDRESS; - string = XSTRING (temp)->data; + string = SDATA (temp); /* Count dots in `emacs-version'. */ while (*string) @@ -817,7 +817,7 @@ main (argc, argv, envp) } else { - printf ("GNU Emacs %s\n", XSTRING (tem)->data); + printf ("GNU Emacs %s\n", SDATA (tem)); printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n"); printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n"); printf ("You may redistribute copies of Emacs\n"); @@ -1908,7 +1908,7 @@ all of which are called before Emacs is actually killed. */) kill it because we are exiting Emacs deliberately (not crashing). Do it after shut_down_emacs, which does an auto-save. */ if (STRINGP (Vauto_save_list_file_name)) - unlink (XSTRING (Vauto_save_list_file_name)->data); + unlink (SDATA (Vauto_save_list_file_name)); exit (INTEGERP (arg) ? XINT (arg) #ifdef VMS @@ -1977,8 +1977,8 @@ shut_down_emacs (sig, no_x, stuff) #ifdef HAVE_X_WINDOWS /* It's not safe to call intern here. Maybe we are crashing. */ if (!noninteractive && SYMBOLP (Vwindow_system) - && XSTRING (SYMBOL_NAME (Vwindow_system))->size == 1 - && XSTRING (SYMBOL_NAME (Vwindow_system))->data[0] == 'x' + && SCHARS (SYMBOL_NAME (Vwindow_system)) == 1 + && SREF (SYMBOL_NAME (Vwindow_system), 0) == 'x' && ! no_x) Fx_close_current_connection (); #endif /* HAVE_X_WINDOWS */ @@ -2036,7 +2036,7 @@ This function exists on systems that use HAVE_SHM. */) #ifndef SYSTEM_MALLOC memory_warnings (my_edata, malloc_warning); #endif - map_out_data (XSTRING (filename)->data); + map_out_data (SDATA (filename)); Vpurify_flag = tem; @@ -2075,7 +2075,7 @@ You must run Emacs in batch mode in order to dump it. */) if (!NILP (symfile)) { CHECK_STRING (symfile); - if (XSTRING (symfile)->size) + if (SCHARS (symfile)) symfile = Fexpand_file_name (symfile, Qnil); } @@ -2092,7 +2092,7 @@ You must run Emacs in batch mode in order to dump it. */) fflush (stdout); #ifdef VMS - mapout_data (XSTRING (filename)->data); + mapout_data (SDATA (filename)); #else /* Tell malloc where start of impure now is. */ /* Also arrange for warnings when nearly out of space. */ @@ -2110,8 +2110,8 @@ You must run Emacs in batch mode in order to dump it. */) #ifdef USE_MMAP_FOR_BUFFERS mmap_set_vars (0); #endif - unexec (XSTRING (filename)->data, - !NILP (symfile) ? XSTRING (symfile)->data : 0, my_edata, 0, 0); + unexec (SDATA (filename), + !NILP (symfile) ? SDATA (symfile) : 0, my_edata, 0, 0); #ifdef USE_MMAP_FOR_BUFFERS mmap_set_vars (1); #endif @@ -2151,7 +2151,7 @@ synchronize_locale (category, plocale, desired_locale) { *plocale = desired_locale; setlocale (category, (STRINGP (desired_locale) - ? (char *)(XSTRING (desired_locale)->data) + ? (char *)(SDATA (desired_locale)) : "")); } } diff --git a/src/eval.c b/src/eval.c index 4381901c896..3e3b3bd7d83 100644 --- a/src/eval.c +++ b/src/eval.c @@ -837,7 +837,7 @@ on its property list). */) if (INTEGERP (documentation) && XINT (documentation) < 0) return Qt; if (STRINGP (documentation) - && ((unsigned char) XSTRING (documentation)->data[0] == '*')) + && ((unsigned char) SREF (documentation, 0) == '*')) return Qt; /* If it is (STRING . INTEGER), a negative integer means a user variable. */ if (CONSP (documentation) @@ -1554,7 +1554,7 @@ See also the function `condition-case'. */) data = Fcons (error_symbol, data); string = Ferror_message_string (data); - fatal ("%s", XSTRING (string)->data, 0); + fatal ("%s", SDATA (string), 0); } /* Return nonzero iff LIST is a non-nil atom or @@ -1920,7 +1920,7 @@ do_autoload (fundef, funname) of what files are preloaded and when. */ if (! NILP (Vpurify_flag)) error ("Attempt to autoload %s while preparing to dump", - XSTRING (SYMBOL_NAME (funname))->data); + SDATA (SYMBOL_NAME (funname))); fun = funname; CHECK_SYMBOL (funname); @@ -1959,7 +1959,7 @@ do_autoload (fundef, funname) if (!NILP (Fequal (fun, fundef))) error ("Autoloading failed to define function %s", - XSTRING (SYMBOL_NAME (funname))->data); + SDATA (SYMBOL_NAME (funname))); UNGCPRO; } @@ -2938,7 +2938,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, { tem = AREF (object, COMPILED_BYTECODE); if (CONSP (tem) && STRINGP (XCAR (tem))) - error ("Invalid byte code in %s", XSTRING (XCAR (tem))->data); + error ("Invalid byte code in %s", SDATA (XCAR (tem))); else error ("Invalid byte code"); } diff --git a/src/fileio.c b/src/fileio.c index ce27fad4516..c3f82613d83 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -269,8 +269,8 @@ report_file_error (string, data) default: /* System error messages are capitalized. Downcase the initial unless it is followed by a slash. */ - if (XSTRING (errstring)->data[1] != '/') - XSTRING (errstring)->data[0] = DOWNCASE (XSTRING (errstring)->data[0]); + if (SREF (errstring, 1) != '/') + SREF (errstring, 0) = DOWNCASE (SREF (errstring, 0)); Fsignal (Qfile_error, Fcons (build_string (string), Fcons (errstring, data))); @@ -408,11 +408,11 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'. */) #ifdef FILE_SYSTEM_CASE filename = FILE_SYSTEM_CASE (filename); #endif - beg = XSTRING (filename)->data; + beg = SDATA (filename); #ifdef DOS_NT beg = strcpy (alloca (strlen (beg) + 1), beg); #endif - p = beg + STRING_BYTES (XSTRING (filename)); + p = beg + SBYTES (filename); while (p != beg && !IS_DIRECTORY_SEP (p[-1]) #ifdef VMS @@ -480,8 +480,8 @@ or the entire name if it contains no slash. */) if (!NILP (handler)) return call2 (handler, Qfile_name_nondirectory, filename); - beg = XSTRING (filename)->data; - end = p = beg + STRING_BYTES (XSTRING (filename)); + beg = SDATA (filename); + end = p = beg + SBYTES (filename); while (p != beg && !IS_DIRECTORY_SEP (p[-1]) #ifdef VMS @@ -637,8 +637,8 @@ On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc. */) if (!NILP (handler)) return call2 (handler, Qfile_name_as_directory, file); - buf = (char *) alloca (STRING_BYTES (XSTRING (file)) + 10); - return build_string (file_name_as_directory (buf, XSTRING (file)->data)); + buf = (char *) alloca (SBYTES (file) + 10); + return build_string (file_name_as_directory (buf, SDATA (file))); } /* @@ -833,11 +833,11 @@ it returns a file name such as \"[X]Y.DIR.1\". */) /* 20 extra chars is insufficient for VMS, since we might perform a logical name translation. an equivalence string can be up to 255 chars long, so grab that much extra space... - sss */ - buf = (char *) alloca (STRING_BYTES (XSTRING (directory)) + 20 + 255); + buf = (char *) alloca (SBYTES (directory) + 20 + 255); #else - buf = (char *) alloca (STRING_BYTES (XSTRING (directory)) + 20); + buf = (char *) alloca (SBYTES (directory) + 20); #endif - directory_file_name (XSTRING (directory)->data, buf); + directory_file_name (SDATA (directory), buf); return build_string (buf); } @@ -912,10 +912,10 @@ make_temp_name (prefix, base64_p) #endif } - len = XSTRING (prefix)->size; + len = SCHARS (prefix); val = make_uninit_string (len + 3 + pidlen); - data = XSTRING (val)->data; - bcopy(XSTRING (prefix)->data, data, len); + data = SDATA (val); + bcopy(SDATA (prefix), data, len); p = data + len; bcopy (pidbuf, p, pidlen); @@ -970,7 +970,7 @@ make_temp_name (prefix, base64_p) } error ("Cannot create temporary name for prefix `%s'", - XSTRING (prefix)->data); + SDATA (prefix)); return Qnil; } @@ -1073,7 +1073,7 @@ See also the function `substitute-in-file-name'. */) return call3 (handler, Qexpand_file_name, name, default_directory); } - o = XSTRING (default_directory)->data; + o = SDATA (default_directory); /* Make sure DEFAULT_DIRECTORY is properly expanded. It would be better to do this down below where we actually use @@ -1118,7 +1118,7 @@ See also the function `substitute-in-file-name'. */) name = FILE_SYSTEM_CASE (name); #endif - nm = XSTRING (name)->data; + nm = SDATA (name); #ifdef DOS_NT /* We will force directory separators to be either all \ or /, so make @@ -1292,21 +1292,21 @@ See also the function `substitute-in-file-name'. */) #ifdef WINDOWSNT if (IS_DIRECTORY_SEP (nm[1])) { - if (strcmp (nm, XSTRING (name)->data) != 0) + if (strcmp (nm, SDATA (name)) != 0) name = build_string (nm); } else #endif /* drive must be set, so this is okay */ - if (strcmp (nm - 2, XSTRING (name)->data) != 0) + if (strcmp (nm - 2, SDATA (name)) != 0) { name = make_string (nm - 2, p - nm + 2); - XSTRING (name)->data[0] = DRIVE_LETTER (drive); - XSTRING (name)->data[1] = ':'; + SREF (name, 0) = DRIVE_LETTER (drive); + SREF (name, 1) = ':'; } return name; #else /* not DOS_NT */ - if (nm == XSTRING (name)->data) + if (nm == SDATA (name)) return name; return build_string (nm); #endif /* not DOS_NT */ @@ -1419,7 +1419,7 @@ See also the function `substitute-in-file-name'. */) #endif && !newdir) { - newdir = XSTRING (default_directory)->data; + newdir = SDATA (default_directory); #ifdef DOS_NT /* Note if special escape prefix is present, but remove for now. */ if (newdir[0] == '/' && newdir[1] == ':') @@ -1726,7 +1726,7 @@ See also the function `substitute-in-file-name'.") name = Fupcase (name); #endif - nm = XSTRING (name)->data; + nm = SDATA (name); /* If nm is absolute, flush ...// and detect /./ and /../. If no /./ or /../ we can return right away. */ @@ -1835,7 +1835,7 @@ See also the function `substitute-in-file-name'.") if (index (nm, '/')) return build_string (sys_translate_unix (nm)); #endif /* VMS */ - if (nm == XSTRING (name)->data) + if (nm == SDATA (name)) return name; return build_string (nm); } @@ -1896,7 +1896,7 @@ See also the function `substitute-in-file-name'.") if (NILP (defalt)) defalt = current_buffer->directory; CHECK_STRING (defalt); - newdir = XSTRING (defalt)->data; + newdir = SDATA (defalt); } /* Now concatenate the directory and name to new space in the stack frame */ @@ -2046,13 +2046,13 @@ duplicates what `expand-file-name' does. */) if (!NILP (handler)) return call2 (handler, Qsubstitute_in_file_name, filename); - nm = XSTRING (filename)->data; + nm = SDATA (filename); #ifdef DOS_NT nm = strcpy (alloca (strlen (nm) + 1), nm); CORRECT_DIR_SEPS (nm); - substituted = (strcmp (nm, XSTRING (filename)->data) != 0); + substituted = (strcmp (nm, SDATA (filename)) != 0); #endif - endp = nm + STRING_BYTES (XSTRING (filename)); + endp = nm + SBYTES (filename); /* If /~ or // appears, discard everything through first slash. */ @@ -2168,7 +2168,7 @@ duplicates what `expand-file-name' does. */) /* If substitution required, recopy the string and do it */ /* Make space in stack frame for the new copy */ - xnm = (unsigned char *) alloca (STRING_BYTES (XSTRING (filename)) + total + 1); + xnm = (unsigned char *) alloca (SBYTES (filename) + total + 1); x = xnm; /* Copy the rest of the name through, replacing $ constructs with values */ @@ -2279,16 +2279,16 @@ expand_and_dir_to_file (filename, defdir) absname = Fexpand_file_name (filename, defdir); #ifdef VMS { - register int c = XSTRING (absname)->data[STRING_BYTES (XSTRING (absname)) - 1]; + register int c = SREF (absname, SBYTES (absname) - 1); if (c == ':' || c == ']' || c == '>') absname = Fdirectory_file_name (absname); } #else /* Remove final slash, if any (unless this is the root dir). stat behaves differently depending! */ - if (XSTRING (absname)->size > 1 - && IS_DIRECTORY_SEP (XSTRING (absname)->data[STRING_BYTES (XSTRING (absname)) - 1]) - && !IS_DEVICE_SEP (XSTRING (absname)->data[STRING_BYTES (XSTRING (absname))-2])) + if (SCHARS (absname) > 1 + && IS_DIRECTORY_SEP (SREF (absname, SBYTES (absname) - 1)) + && !IS_DEVICE_SEP (SREF (absname, SBYTES (absname)-2))) /* We cannot take shortcuts; they might be wrong for magic file names. */ absname = Fdirectory_file_name (absname); #endif @@ -2323,7 +2323,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick) /* stat is a good way to tell whether the file exists, regardless of what access permissions it has. */ - if (stat (XSTRING (encoded_filename)->data, &statbuf) >= 0) + if (stat (SDATA (encoded_filename), &statbuf) >= 0) { if (! interactive) Fsignal (Qfile_already_exists, @@ -2331,7 +2331,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick) Fcons (absname, Qnil))); GCPRO1 (absname); tem = format1 ("File %s already exists; %s anyway? ", - XSTRING (absname)->data, querystring); + SDATA (absname), querystring); if (quick) tem = Fy_or_n_p (tem); else @@ -2404,12 +2404,12 @@ A prefix arg makes KEEP-TIME non-nil. */) || INTEGERP (ok_if_already_exists)) barf_or_query_if_file_exists (encoded_newname, "copy to it", INTEGERP (ok_if_already_exists), &out_st, 0); - else if (stat (XSTRING (encoded_newname)->data, &out_st) < 0) + else if (stat (SDATA (encoded_newname), &out_st) < 0) out_st.st_mode = 0; #ifdef WINDOWSNT - if (!CopyFile (XSTRING (encoded_file)->data, - XSTRING (encoded_newname)->data, + if (!CopyFile (SDATA (encoded_file), + SDATA (encoded_newname), FALSE)) report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil))); else if (NILP (keep_time)) @@ -2419,7 +2419,7 @@ A prefix arg makes KEEP-TIME non-nil. */) char * filename; EMACS_GET_TIME (now); - filename = XSTRING (encoded_newname)->data; + filename = SDATA (encoded_newname); /* Ensure file is writable while its modified time is set. */ attributes = GetFileAttributes (filename); @@ -2436,7 +2436,7 @@ A prefix arg makes KEEP-TIME non-nil. */) SetFileAttributes (filename, attributes); } #else /* not WINDOWSNT */ - ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0); + ifd = emacs_open (SDATA (encoded_file), O_RDONLY, 0); if (ifd < 0) report_file_error ("Opening input file", Fcons (file, Qnil)); @@ -2472,13 +2472,13 @@ A prefix arg makes KEEP-TIME non-nil. */) #ifdef VMS /* Create the copy file with the same record format as the input file */ - ofd = sys_creat (XSTRING (encoded_newname)->data, 0666, ifd); + ofd = sys_creat (SDATA (encoded_newname), 0666, ifd); #else #ifdef MSDOS /* System's default file type was set to binary by _fmode in emacs.c. */ - ofd = creat (XSTRING (encoded_newname)->data, S_IREAD | S_IWRITE); + ofd = creat (SDATA (encoded_newname), S_IREAD | S_IWRITE); #else /* not MSDOS */ - ofd = creat (XSTRING (encoded_newname)->data, 0666); + ofd = creat (SDATA (encoded_newname), 0666); #endif /* not MSDOS */ #endif /* VMS */ if (ofd < 0) @@ -2504,14 +2504,14 @@ A prefix arg makes KEEP-TIME non-nil. */) EMACS_TIME atime, mtime; EMACS_SET_SECS_USECS (atime, st.st_atime, 0); EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0); - if (set_file_times (XSTRING (encoded_newname)->data, + if (set_file_times (SDATA (encoded_newname), atime, mtime)) Fsignal (Qfile_date_error, Fcons (build_string ("Cannot set file date"), Fcons (newname, Qnil))); } #ifndef MSDOS - chmod (XSTRING (encoded_newname)->data, st.st_mode & 07777); + chmod (SDATA (encoded_newname), st.st_mode & 07777); #else /* MSDOS */ #if defined (__DJGPP__) && __DJGPP__ > 1 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits, @@ -2519,7 +2519,7 @@ A prefix arg makes KEEP-TIME non-nil. */) get only the READ bit, which will make the copied file read-only, so it's better not to chmod at all. */ if ((_djstat_flags & _STFAIL_WRITEBIT) == 0) - chmod (XSTRING (encoded_newname)->data, st.st_mode & 07777); + chmod (SDATA (encoded_newname), st.st_mode & 07777); #endif /* DJGPP version 2 or newer */ #endif /* MSDOS */ } @@ -2553,7 +2553,7 @@ DEFUN ("make-directory-internal", Fmake_directory_internal, encoded_dir = ENCODE_FILE (directory); - dir = XSTRING (encoded_dir)->data; + dir = SDATA (encoded_dir); #ifdef WINDOWSNT if (mkdir (dir) != 0) @@ -2583,7 +2583,7 @@ DEFUN ("delete-directory", Fdelete_directory, Sdelete_directory, 1, 1, "FDelete encoded_dir = ENCODE_FILE (directory); - dir = XSTRING (encoded_dir)->data; + dir = SDATA (encoded_dir); if (rmdir (dir) != 0) report_file_error ("Removing directory", Flist (1, &directory)); @@ -2609,7 +2609,7 @@ If file has multiple names, it continues to exist with the other names. */) encoded_file = ENCODE_FILE (filename); - if (0 > unlink (XSTRING (encoded_file)->data)) + if (0 > unlink (SDATA (encoded_file))) report_file_error ("Removing old name", Flist (1, &filename)); return Qnil; } @@ -2679,10 +2679,10 @@ This is what happens in interactive use with M-x. */) barf_or_query_if_file_exists (encoded_newname, "rename to it", INTEGERP (ok_if_already_exists), 0, 0); #ifndef BSD4_1 - if (0 > rename (XSTRING (encoded_file)->data, XSTRING (encoded_newname)->data)) + if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname))) #else - if (0 > link (XSTRING (encoded_file)->data, XSTRING (encoded_newname)->data) - || 0 > unlink (XSTRING (encoded_file)->data)) + if (0 > link (SDATA (encoded_file), SDATA (encoded_newname)) + || 0 > unlink (SDATA (encoded_file))) #endif { if (errno == EXDEV) @@ -2754,8 +2754,8 @@ This is what happens in interactive use with M-x. */) barf_or_query_if_file_exists (encoded_newname, "make it a new name", INTEGERP (ok_if_already_exists), 0, 0); - unlink (XSTRING (newname)->data); - if (0 > link (XSTRING (encoded_file)->data, XSTRING (encoded_newname)->data)) + unlink (SDATA (newname)); + if (0 > link (SDATA (encoded_file), SDATA (encoded_newname))) { #ifdef NO_ARG_ARRAY args[0] = file; @@ -2795,7 +2795,7 @@ This happens for interactive use with M-x. */) /* If the link target has a ~, we must expand it to get a truly valid file name. Otherwise, do not expand; we want to permit links to relative file names. */ - if (XSTRING (filename)->data[0] == '~') + if (SREF (filename, 0) == '~') filename = Fexpand_file_name (filename, Qnil); linkname = Fexpand_file_name (linkname, Qnil); @@ -2820,15 +2820,15 @@ This happens for interactive use with M-x. */) || INTEGERP (ok_if_already_exists)) barf_or_query_if_file_exists (encoded_linkname, "make it a link", INTEGERP (ok_if_already_exists), 0, 0); - if (0 > symlink (XSTRING (encoded_filename)->data, - XSTRING (encoded_linkname)->data)) + if (0 > symlink (SDATA (encoded_filename), + SDATA (encoded_linkname))) { /* If we didn't complain already, silently delete existing file. */ if (errno == EEXIST) { - unlink (XSTRING (encoded_linkname)->data); - if (0 <= symlink (XSTRING (encoded_filename)->data, - XSTRING (encoded_linkname)->data)) + unlink (SDATA (encoded_linkname)); + if (0 <= symlink (SDATA (encoded_filename), + SDATA (encoded_linkname))) { UNGCPRO; return Qnil; @@ -2860,15 +2860,15 @@ If STRING is nil or a null string, the logical name NAME is deleted. */) { CHECK_STRING (name); if (NILP (string)) - delete_logical_name (XSTRING (name)->data); + delete_logical_name (SDATA (name)); else { CHECK_STRING (string); - if (XSTRING (string)->size == 0) - delete_logical_name (XSTRING (name)->data); + if (SCHARS (string) == 0) + delete_logical_name (SDATA (name)); else - define_logical_name (XSTRING (name)->data, XSTRING (string)->data); + define_logical_name (SDATA (name), SDATA (string)); } return string; @@ -2887,7 +2887,7 @@ DEFUN ("sysnetunam", Fsysnetunam, Ssysnetunam, 2, 2, 0, CHECK_STRING (path); CHECK_STRING (login); - netresult = netunam (XSTRING (path)->data, XSTRING (login)->data); + netresult = netunam (SDATA (path), SDATA (login)); if (netresult == -1) return Qnil; @@ -2906,7 +2906,7 @@ On Unix, this is a name starting with a `/' or a `~'. */) unsigned char *ptr; CHECK_STRING (filename); - ptr = XSTRING (filename)->data; + ptr = SDATA (filename); if (IS_DIRECTORY_SEP (*ptr) || *ptr == '~' #ifdef VMS /* ??? This criterion is probably wrong for '<'. */ @@ -3003,7 +3003,7 @@ See also `file-readable-p' and `file-attributes'. */) absname = ENCODE_FILE (absname); - return (stat (XSTRING (absname)->data, &statbuf) >= 0) ? Qt : Qnil; + return (stat (SDATA (absname), &statbuf) >= 0) ? Qt : Qnil; } DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0, @@ -3026,7 +3026,7 @@ For a directory, this means you can access files in that directory. */) absname = ENCODE_FILE (absname); - return (check_executable (XSTRING (absname)->data) ? Qt : Qnil); + return (check_executable (SDATA (absname)) ? Qt : Qnil); } DEFUN ("file-readable-p", Ffile_readable_p, Sfile_readable_p, 1, 1, 0, @@ -3055,7 +3055,7 @@ See also `file-exists-p' and `file-attributes'. */) #if defined(DOS_NT) || defined(macintosh) /* Under MS-DOS, Windows, and Macintosh, open does not work for directories. */ - if (access (XSTRING (absname)->data, 0) == 0) + if (access (SDATA (absname), 0) == 0) return Qt; return Qnil; #else /* not DOS_NT and not macintosh */ @@ -3064,13 +3064,13 @@ See also `file-exists-p' and `file-attributes'. */) /* Opening a fifo without O_NONBLOCK can wait. We don't want to wait. But we don't want to mess wth O_NONBLOCK except in the case of a fifo, on a system which handles it. */ - desc = stat (XSTRING (absname)->data, &statbuf); + desc = stat (SDATA (absname), &statbuf); if (desc < 0) return Qnil; if (S_ISFIFO (statbuf.st_mode)) flags |= O_NONBLOCK; #endif - desc = emacs_open (XSTRING (absname)->data, flags, 0); + desc = emacs_open (SDATA (absname), flags, 0); if (desc < 0) return Qnil; emacs_close (desc); @@ -3099,8 +3099,8 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0, return call2 (handler, Qfile_writable_p, absname); encoded = ENCODE_FILE (absname); - if (stat (XSTRING (encoded)->data, &statbuf) >= 0) - return (check_writable (XSTRING (encoded)->data) + if (stat (SDATA (encoded), &statbuf) >= 0) + return (check_writable (SDATA (encoded)) ? Qt : Qnil); dir = Ffile_name_directory (absname); @@ -3118,11 +3118,11 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0, /* The read-only attribute of the parent directory doesn't affect whether a file or directory can be created within it. Some day we should check ACLs though, which do affect this. */ - if (stat (XSTRING (dir)->data, &statbuf) < 0) + if (stat (SDATA (dir), &statbuf) < 0) return Qnil; return (statbuf.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil; #else - return (check_writable (!NILP (dir) ? (char *) XSTRING (dir)->data : "") + return (check_writable (!NILP (dir) ? (char *) SDATA (dir) : "") ? Qt : Qnil); #endif } @@ -3150,9 +3150,9 @@ If there is no error, we return nil. */) encoded_filename = ENCODE_FILE (absname); - fd = emacs_open (XSTRING (encoded_filename)->data, O_RDONLY, 0); + fd = emacs_open (SDATA (encoded_filename), O_RDONLY, 0); if (fd < 0) - report_file_error (XSTRING (string)->data, Fcons (filename, Qnil)); + report_file_error (SDATA (string), Fcons (filename, Qnil)); emacs_close (fd); return Qnil; @@ -3192,7 +3192,7 @@ Otherwise returns nil. */) bzero (buf, bufsize); errno = 0; - valsize = readlink (XSTRING (filename)->data, buf, bufsize); + valsize = readlink (SDATA (filename), buf, bufsize); if (valsize == -1) { #ifdef ERANGE @@ -3241,7 +3241,7 @@ See `file-symlink-p' to distinguish symlinks. */) absname = ENCODE_FILE (absname); - if (stat (XSTRING (absname)->data, &st) < 0) + if (stat (SDATA (absname), &st) < 0) return Qnil; return (st.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil; } @@ -3307,7 +3307,7 @@ This is the sort of file that holds an ordinary stream of data bytes. */) /* Tell stat to use expensive method to get accurate info. */ Vw32_get_true_file_attributes = Qt; - result = stat (XSTRING (absname)->data, &st); + result = stat (SDATA (absname), &st); Vw32_get_true_file_attributes = tem; if (result < 0) @@ -3315,7 +3315,7 @@ This is the sort of file that holds an ordinary stream of data bytes. */) return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; } #else - if (stat (XSTRING (absname)->data, &st) < 0) + if (stat (SDATA (absname), &st) < 0) return Qnil; return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; #endif @@ -3340,10 +3340,10 @@ DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, absname = ENCODE_FILE (absname); - if (stat (XSTRING (absname)->data, &st) < 0) + if (stat (SDATA (absname), &st) < 0) return Qnil; #if defined (MSDOS) && __DJGPP__ < 2 - if (check_executable (XSTRING (absname)->data)) + if (check_executable (SDATA (absname))) st.st_mode |= S_IEXEC; #endif /* MSDOS && __DJGPP__ < 2 */ @@ -3370,7 +3370,7 @@ Only the 12 low bits of MODE are used. */) encoded_absname = ENCODE_FILE (absname); - if (chmod (XSTRING (encoded_absname)->data, XINT (mode)) < 0) + if (chmod (SDATA (encoded_absname), XINT (mode)) < 0) report_file_error ("Doing chmod", Fcons (absname, Qnil)); return Qnil; @@ -3456,12 +3456,12 @@ otherwise, if FILE2 does not exist, the answer is t. */) absname2 = ENCODE_FILE (absname2); UNGCPRO; - if (stat (XSTRING (absname1)->data, &st) < 0) + if (stat (SDATA (absname1), &st) < 0) return Qnil; mtime1 = st.st_mtime; - if (stat (XSTRING (absname2)->data, &st) < 0) + if (stat (SDATA (absname2), &st) < 0) return Qt; return (mtime1 > st.st_mtime) ? Qt : Qnil; @@ -3640,15 +3640,15 @@ actually used. */) /* Tell stat to use expensive method to get accurate info. */ Vw32_get_true_file_attributes = Qt; - total = stat (XSTRING (filename)->data, &st); + total = stat (SDATA (filename), &st); Vw32_get_true_file_attributes = tem; } if (total < 0) #else #ifndef APOLLO - if (stat (XSTRING (filename)->data, &st) < 0) + if (stat (SDATA (filename), &st) < 0) #else - if ((fd = emacs_open (XSTRING (filename)->data, O_RDONLY, 0)) < 0 + if ((fd = emacs_open (SDATA (filename), O_RDONLY, 0)) < 0 || fstat (fd, &st) < 0) #endif /* not APOLLO */ #endif /* WINDOWSNT */ @@ -3683,7 +3683,7 @@ actually used. */) #endif if (fd < 0) - if ((fd = emacs_open (XSTRING (filename)->data, O_RDONLY, 0)) < 0) + if ((fd = emacs_open (SDATA (filename), O_RDONLY, 0)) < 0) goto badopen; /* Replacement should preserve point as it preserves markers. */ @@ -3779,7 +3779,7 @@ actually used. */) if (nread < 0) error ("IO error reading %s: %s", - XSTRING (orig_filename)->data, emacs_strerror (errno)); + SDATA (orig_filename), emacs_strerror (errno)); else if (nread > 0) { struct buffer *prev = current_buffer; @@ -3896,7 +3896,7 @@ actually used. */) nread = emacs_read (fd, buffer, sizeof buffer); if (nread < 0) error ("IO error reading %s: %s", - XSTRING (orig_filename)->data, emacs_strerror (errno)); + SDATA (orig_filename), emacs_strerror (errno)); else if (nread == 0) break; @@ -3967,7 +3967,7 @@ actually used. */) nread = emacs_read (fd, buffer + total_read, trial - total_read); if (nread < 0) error ("IO error reading %s: %s", - XSTRING (orig_filename)->data, emacs_strerror (errno)); + SDATA (orig_filename), emacs_strerror (errno)); else if (nread == 0) break; total_read += nread; @@ -4150,7 +4150,7 @@ actually used. */) if (how_much == -1) error ("IO error reading %s: %s", - XSTRING (orig_filename)->data, emacs_strerror (errno)); + SDATA (orig_filename), emacs_strerror (errno)); else if (how_much == -2) error ("maximum buffer size exceeded"); } @@ -4370,7 +4370,7 @@ actually used. */) if (how_much < 0) error ("IO error reading %s: %s", - XSTRING (orig_filename)->data, emacs_strerror (errno)); + SDATA (orig_filename), emacs_strerror (errno)); notfound: @@ -4493,7 +4493,7 @@ actually used. */) if (!EQ (current_buffer->undo_list, Qt)) current_buffer->undo_list = Qnil; #ifdef APOLLO - stat (XSTRING (filename)->data, &st); + stat (SDATA (filename), &st); #endif if (NILP (handler)) @@ -4880,7 +4880,7 @@ This does code conversion according to the value of encoded_filename = ENCODE_FILE (filename); - fn = XSTRING (encoded_filename)->data; + fn = SDATA (encoded_filename); desc = -1; if (!NILP (append)) #ifdef DOS_NT @@ -4897,7 +4897,7 @@ This does code conversion according to the value of desc = emacs_open (fn, O_RDWR, 0); if (desc < 0) desc = creat_copy_attrs (STRINGP (current_buffer->filename) - ? XSTRING (current_buffer->filename)->data : 0, + ? SDATA (current_buffer->filename) : 0, fn); } else /* Write to temporary name and rename if no errors */ @@ -4909,8 +4909,8 @@ This does code conversion according to the value of { temp_name = Fmake_temp_name (concat2 (temp_name, build_string ("$$SAVE$$"))); - fname = XSTRING (filename)->data; - fn = XSTRING (temp_name)->data; + fname = SDATA (filename); + fn = SDATA (temp_name); desc = creat_copy_attrs (fname, fn); if (desc < 0) { @@ -5019,7 +5019,7 @@ This does code conversion according to the value of if (STRINGP (start)) { - failure = 0 > a_write (desc, start, 0, XSTRING (start)->size, + failure = 0 > a_write (desc, start, 0, SCHARS (start), &annotations, &coding); save_errno = errno; } @@ -5129,7 +5129,7 @@ This does code conversion according to the value of current_buffer->modtime = st.st_mtime; if (failure) - error ("IO error writing %s: %s", XSTRING (filename)->data, + error ("IO error writing %s: %s", SDATA (filename), emacs_strerror (save_errno)); if (visiting) @@ -5304,7 +5304,7 @@ a_write (desc, string, pos, nchars, annot, coding) tem = Fcdr (Fcar (*annot)); if (STRINGP (tem)) { - if (0 > e_write (desc, tem, 0, XSTRING (tem)->size, coding)) + if (0 > e_write (desc, tem, 0, SCHARS (tem), coding)) return -1; } *annot = Fcdr (*annot); @@ -5340,8 +5340,8 @@ e_write (desc, string, start, end, coding) if (STRINGP (string)) { - addr = XSTRING (string)->data; - nbytes = STRING_BYTES (XSTRING (string)); + addr = SDATA (string); + nbytes = SBYTES (string); coding->src_multibyte = STRING_MULTIBYTE (string); } else if (start < end) @@ -5429,7 +5429,7 @@ This means that the file has not been changed since it was visited or saved. */ filename = ENCODE_FILE (b->filename); - if (stat (XSTRING (filename)->data, &st) < 0) + if (stat (SDATA (filename), &st) < 0) { /* If the file doesn't exist now and didn't exist before, we say that it isn't modified, provided the error is a tame one. */ @@ -5497,7 +5497,7 @@ An argument specifies the modification time value to use filename = ENCODE_FILE (filename); - if (stat (XSTRING (filename)->data, &st) >= 0) + if (stat (SDATA (filename), &st) >= 0) current_buffer->modtime = st.st_mtime; } @@ -5519,14 +5519,14 @@ auto_save_error (error) args[2] = Ferror_message_string (error); msg = Fformat (3, args); GCPRO1 (msg); - nbytes = STRING_BYTES (XSTRING (msg)); + nbytes = SBYTES (msg); for (i = 0; i < 3; ++i) { if (i == 0) - message2 (XSTRING (msg)->data, nbytes, STRING_MULTIBYTE (msg)); + message2 (SDATA (msg), nbytes, STRING_MULTIBYTE (msg)); else - message2_nolog (XSTRING (msg)->data, nbytes, STRING_MULTIBYTE (msg)); + message2_nolog (SDATA (msg), nbytes, STRING_MULTIBYTE (msg)); Fsleep_for (make_number (1), Qnil); } @@ -5541,7 +5541,7 @@ auto_save_1 () /* Get visited file's mode to become the auto save file's mode. */ if (! NILP (current_buffer->filename) - && stat (XSTRING (current_buffer->filename)->data, &st) >= 0) + && stat (SDATA (current_buffer->filename), &st) >= 0) /* But make sure we can overwrite it later! */ auto_save_mode_bits = st.st_mode | 0600; else @@ -5635,7 +5635,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) call2 (Qmake_directory, dir, Qt); } - stream = fopen (XSTRING (listfile)->data, "w"); + stream = fopen (SDATA (listfile), "w"); if (stream != NULL) { /* Arrange to close that file whether or not we get an error. @@ -5678,12 +5678,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) { if (!NILP (b->filename)) { - fwrite (XSTRING (b->filename)->data, 1, - STRING_BYTES (XSTRING (b->filename)), stream); + fwrite (SDATA (b->filename), 1, + SBYTES (b->filename), stream); } putc ('\n', stream); - fwrite (XSTRING (b->auto_save_file_name)->data, 1, - STRING_BYTES (XSTRING (b->auto_save_file_name)), stream); + fwrite (SDATA (b->auto_save_file_name), 1, + SBYTES (b->auto_save_file_name), stream); putc ('\n', stream); } @@ -5817,17 +5817,17 @@ double_dollars (val) register int n; int osize, count; - osize = STRING_BYTES (XSTRING (val)); + osize = SBYTES (val); /* Count the number of $ characters. */ - for (n = osize, count = 0, old = XSTRING (val)->data; n > 0; n--) + for (n = osize, count = 0, old = SDATA (val); n > 0; n--) if (*old++ == '$') count++; if (count > 0) { - old = XSTRING (val)->data; - val = make_uninit_multibyte_string (XSTRING (val)->size + count, + old = SDATA (val); + val = make_uninit_multibyte_string (SCHARS (val) + count, osize + count); - new = XSTRING (val)->data; + new = SDATA (val); for (n = osize; n > 0; n--) if (*old != '$') *new++ = *old++; @@ -5870,7 +5870,7 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte /* No need to protect ACTION--we only compare it with t and nil. */ GCPRO5 (string, realdir, name, specdir, orig_string); - if (XSTRING (string)->size == 0) + if (SCHARS (string) == 0) { if (EQ (action, Qlambda)) { @@ -5931,8 +5931,8 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte Lisp_Object tem = XCAR (all); int len; if (STRINGP (tem) && - (len = XSTRING (tem)->size, len > 0) && - IS_DIRECTORY_SEP (XSTRING (tem)->data[len-1])) + (len = SCHARS (tem), len > 0) && + IS_DIRECTORY_SEP (SREF (tem, len-1))) comp = Fcons (tem, comp); } } @@ -5957,7 +5957,7 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte #ifdef VMS /* Supposedly this helps commands such as `cd' that read directory names, but can someone explain how it helps them? -- RMS */ - if (XSTRING (name)->size == 0) + if (SCHARS (name) == 0) return Qt; #endif /* VMS */ if (!NILP (Vread_file_name_predicate)) @@ -6014,23 +6014,23 @@ provides a file dialog box. */) #endif if (homedir != 0 && STRINGP (dir) - && !strncmp (homedir, XSTRING (dir)->data, strlen (homedir)) - && IS_DIRECTORY_SEP (XSTRING (dir)->data[strlen (homedir)])) + && !strncmp (homedir, SDATA (dir), strlen (homedir)) + && IS_DIRECTORY_SEP (SDATA (dir)[strlen (homedir)])) { - dir = make_string (XSTRING (dir)->data + strlen (homedir) - 1, - STRING_BYTES (XSTRING (dir)) - strlen (homedir) + 1); - XSTRING (dir)->data[0] = '~'; + dir = make_string (SDATA (dir) + strlen (homedir) - 1, + SBYTES (dir) - strlen (homedir) + 1); + SREF (dir, 0) = '~'; } /* Likewise for default_filename. */ if (homedir != 0 && STRINGP (default_filename) - && !strncmp (homedir, XSTRING (default_filename)->data, strlen (homedir)) - && IS_DIRECTORY_SEP (XSTRING (default_filename)->data[strlen (homedir)])) + && !strncmp (homedir, SDATA (default_filename), strlen (homedir)) + && IS_DIRECTORY_SEP (SDATA (default_filename)[strlen (homedir)])) { default_filename - = make_string (XSTRING (default_filename)->data + strlen (homedir) - 1, - STRING_BYTES (XSTRING (default_filename)) - strlen (homedir) + 1); - XSTRING (default_filename)->data[0] = '~'; + = make_string (SDATA (default_filename) + strlen (homedir) - 1, + SBYTES (default_filename) - strlen (homedir) + 1); + SREF (default_filename, 0) = '~'; } if (!NILP (default_filename)) { @@ -6048,7 +6048,7 @@ provides a file dialog box. */) args[0] = insdef; args[1] = initial; insdef = Fconcat (2, args); - pos = make_number (XSTRING (double_dollars (dir))->size); + pos = make_number (SCHARS (double_dollars (dir))); insdef = Fcons (double_dollars (insdef), pos); } else @@ -6093,7 +6093,7 @@ provides a file dialog box. */) /* If DIR contains a file name, split it. */ Lisp_Object file; file = Ffile_name_nondirectory (dir); - if (XSTRING (file)->size && NILP (default_filename)) + if (SCHARS (file) && NILP (default_filename)) { default_filename = file; dir = Ffile_name_directory (dir); @@ -6137,7 +6137,7 @@ provides a file dialog box. */) if (!NILP (tem) && !NILP (default_filename)) val = default_filename; - else if (XSTRING (val)->size == 0 && NILP (insdef)) + else if (SCHARS (val) == 0 && NILP (insdef)) { if (!NILP (default_filename)) val = default_filename; diff --git a/src/filelock.c b/src/filelock.c index b85f0a68a0e..33de9a4e7db 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -222,7 +222,7 @@ get_boot_time () args[3] = Qnil; args[4] = build_string ("-c"); sprintf (cmd_string, "gunzip < %s.%d.gz > %s", - WTMP_FILE, counter, XSTRING (tempname)->data); + WTMP_FILE, counter, SDATA (tempname)); args[5] = build_string (cmd_string); Fcall_process (6, args); filename = tempname; @@ -232,9 +232,9 @@ get_boot_time () if (! NILP (filename)) { - get_boot_time_1 (XSTRING (filename)->data, 1); + get_boot_time_1 (SDATA (filename), 1); if (delete_flag) - unlink (XSTRING (filename)->data); + unlink (SDATA (filename)); } } @@ -325,7 +325,7 @@ typedef struct trailing period plus one for the digit after it plus one for the null. */ #define MAKE_LOCK_NAME(lock, file) \ - (lock = (char *) alloca (STRING_BYTES (XSTRING (file)) + 2 + 1 + 1 + 1), \ + (lock = (char *) alloca (SBYTES (file) + 2 + 1 + 1 + 1), \ fill_in_lock_file_name (lock, (file))) static void @@ -337,7 +337,7 @@ fill_in_lock_file_name (lockfile, fn) struct stat st; int count = 0; - strcpy (lockfile, XSTRING (fn)->data); + strcpy (lockfile, SDATA (fn)); /* Shift the nondirectory part of the file name (including the null) right two characters. Here is one of the places where we'd have to @@ -378,11 +378,11 @@ lock_file_1 (lfname, force) char *lock_info_str; if (STRINGP (Fuser_login_name (Qnil))) - user_name = (char *)XSTRING (Fuser_login_name (Qnil))->data; + user_name = (char *)SDATA (Fuser_login_name (Qnil)); else user_name = ""; if (STRINGP (Fsystem_name ())) - host_name = (char *)XSTRING (Fsystem_name ())->data; + host_name = (char *)SDATA (Fsystem_name ()); else host_name = ""; lock_info_str = (char *)alloca (strlen (user_name) + strlen (host_name) @@ -503,7 +503,7 @@ current_lock_owner (owner, lfname) /* On current host? */ if (STRINGP (Fsystem_name ()) - && strcmp (owner->host, XSTRING (Fsystem_name ())->data) == 0) + && strcmp (owner->host, SDATA (Fsystem_name ())) == 0) { if (owner->pid == getpid ()) ret = 2; /* We own it. */ diff --git a/src/fns.c b/src/fns.c index 01d368ba3d3..217e97ffd56 100644 --- a/src/fns.c +++ b/src/fns.c @@ -132,7 +132,7 @@ To get the number of bytes, use `string-bytes'. */) retry: if (STRINGP (sequence)) - XSETFASTINT (val, XSTRING (sequence)->size); + XSETFASTINT (val, SCHARS (sequence)); else if (VECTORP (sequence)) XSETFASTINT (val, XVECTOR (sequence)->size); else if (CHAR_TABLE_P (sequence)) @@ -208,7 +208,7 @@ If STRING is a multibyte string, this is greater than the length of STRING. */) Lisp_Object string; { CHECK_STRING (string); - return make_number (STRING_BYTES (XSTRING (string))); + return make_number (SBYTES (string)); } DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0, @@ -225,9 +225,9 @@ Symbols are also allowed; their print names are used instead. */) CHECK_STRING (s1); CHECK_STRING (s2); - if (XSTRING (s1)->size != XSTRING (s2)->size - || STRING_BYTES (XSTRING (s1)) != STRING_BYTES (XSTRING (s2)) - || bcmp (XSTRING (s1)->data, XSTRING (s2)->data, STRING_BYTES (XSTRING (s1)))) + if (SCHARS (s1) != SCHARS (s2) + || SBYTES (s1) != SBYTES (s2) + || bcmp (SDATA (s1), SDATA (s2), SBYTES (s1))) return Qnil; return Qt; } @@ -272,11 +272,11 @@ If string STR1 is greater, the value is a positive number N; i1_byte = string_char_to_byte (str1, i1); i2_byte = string_char_to_byte (str2, i2); - end1_char = XSTRING (str1)->size; + end1_char = SCHARS (str1); if (! NILP (end1) && end1_char > XINT (end1)) end1_char = XINT (end1); - end2_char = XSTRING (str2)->size; + end2_char = SCHARS (str2); if (! NILP (end2) && end2_char > XINT (end2)) end2_char = XINT (end2); @@ -290,7 +290,7 @@ If string STR1 is greater, the value is a positive number N; FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c1, str1, i1, i1_byte); else { - c1 = XSTRING (str1)->data[i1++]; + c1 = SREF (str1, i1++); c1 = unibyte_char_to_multibyte (c1); } @@ -298,7 +298,7 @@ If string STR1 is greater, the value is a positive number N; FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c2, str2, i2, i2_byte); else { - c2 = XSTRING (str2)->data[i2++]; + c2 = SREF (str2, i2++); c2 = unibyte_char_to_multibyte (c2); } @@ -354,9 +354,9 @@ Symbols are also allowed; their print names are used instead. */) i1 = i1_byte = i2 = i2_byte = 0; - end = XSTRING (s1)->size; - if (end > XSTRING (s2)->size) - end = XSTRING (s2)->size; + end = SCHARS (s1); + if (end > SCHARS (s2)) + end = SCHARS (s2); while (i1 < end) { @@ -370,7 +370,7 @@ Symbols are also allowed; their print names are used instead. */) if (c1 != c2) return c1 < c2 ? Qt : Qnil; } - return i1 < XSTRING (s2)->size ? Qt : Qnil; + return i1 < SCHARS (s2) ? Qt : Qnil; } static Lisp_Object concat (); @@ -641,11 +641,11 @@ concat (nargs, args, target_type, last_special) if (STRING_MULTIBYTE (this)) { some_multibyte = 1; - result_len_byte += STRING_BYTES (XSTRING (this)); + result_len_byte += SBYTES (this); } else - result_len_byte += count_size_as_multibyte (XSTRING (this)->data, - XSTRING (this)->size); + result_len_byte += count_size_as_multibyte (SDATA (this), + SCHARS (this)); } } @@ -695,17 +695,17 @@ concat (nargs, args, target_type, last_special) if (STRINGP (this) && STRINGP (val) && STRING_MULTIBYTE (this) == some_multibyte) { - int thislen_byte = STRING_BYTES (XSTRING (this)); + int thislen_byte = SBYTES (this); int combined; - bcopy (XSTRING (this)->data, XSTRING (val)->data + toindex_byte, - STRING_BYTES (XSTRING (this))); + bcopy (SDATA (this), SDATA (val) + toindex_byte, + SBYTES (this)); combined = (some_multibyte && toindex_byte > 0 - ? count_combining (XSTRING (val)->data, + ? count_combining (SDATA (val), toindex_byte + thislen_byte, toindex_byte) : 0); - if (! NULL_INTERVAL_P (XSTRING (this)->intervals)) + if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) { textprops[num_textprops].argnum = argnum; /* We ignore text properties on characters being combined. */ @@ -714,20 +714,20 @@ concat (nargs, args, target_type, last_special) } toindex_byte += thislen_byte; toindex += thisleni - combined; - XSTRING (val)->size -= combined; + SCHARS (val) -= combined; } /* Copy a single-byte string to a multibyte string. */ else if (STRINGP (this) && STRINGP (val)) { - if (! NULL_INTERVAL_P (XSTRING (this)->intervals)) + if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) { textprops[num_textprops].argnum = argnum; textprops[num_textprops].from = 0; textprops[num_textprops++].to = toindex; } - toindex_byte += copy_text (XSTRING (this)->data, - XSTRING (val)->data + toindex_byte, - XSTRING (this)->size, 0, 1); + toindex_byte += copy_text (SDATA (this), + SDATA (val) + toindex_byte, + SCHARS (this), 0, 1); toindex += thisleni; } else @@ -755,7 +755,7 @@ concat (nargs, args, target_type, last_special) } else { - XSETFASTINT (elt, XSTRING (this)->data[thisindex++]); + XSETFASTINT (elt, SREF (this, thisindex++)); if (some_multibyte && (XINT (elt) >= 0240 || (XINT (elt) >= 0200 @@ -797,14 +797,14 @@ concat (nargs, args, target_type, last_special) if (some_multibyte) toindex_byte += CHAR_STRING (XINT (elt), - XSTRING (val)->data + toindex_byte); + SDATA (val) + toindex_byte); else - XSTRING (val)->data[toindex_byte++] = XINT (elt); + SREF (val, toindex_byte++) = XINT (elt); if (some_multibyte && toindex_byte > 0 - && count_combining (XSTRING (val)->data, + && count_combining (SDATA (val), toindex_byte, toindex_byte - 1)) - XSTRING (val)->size--; + SCHARS (val)--; else toindex++; } @@ -815,7 +815,7 @@ concat (nargs, args, target_type, last_special) int c = XINT (elt); /* P exists as a variable to avoid a bug on the Masscomp C compiler. */ - unsigned char *p = & XSTRING (val)->data[toindex_byte]; + unsigned char *p = & SREF (val, toindex_byte); toindex_byte += CHAR_STRING (c, p); toindex++; @@ -836,7 +836,7 @@ concat (nargs, args, target_type, last_special) this = args[textprops[argnum].argnum]; props = text_property_list (this, make_number (0), - make_number (XSTRING (this)->size), + make_number (SCHARS (this)), Qnil); /* If successive arguments have properites, be sure that the value of `composition' property be the copy. */ @@ -844,7 +844,7 @@ concat (nargs, args, target_type, last_special) make_composition_value_copy (props); add_text_properties_from_list (val, props, make_number (textprops[argnum].to)); - last_to_end = textprops[argnum].to + XSTRING (this)->size; + last_to_end = textprops[argnum].to + SCHARS (this); } } return val; @@ -875,8 +875,8 @@ string_char_to_byte (string, char_index) return char_index; best_below = best_below_byte = 0; - best_above = XSTRING (string)->size; - best_above_byte = STRING_BYTES (XSTRING (string)); + best_above = SCHARS (string); + best_above_byte = SBYTES (string); if (EQ (string, string_char_byte_cache_string)) { @@ -907,7 +907,7 @@ string_char_to_byte (string, char_index) { while (best_above > char_index) { - unsigned char *pend = XSTRING (string)->data + best_above_byte; + unsigned char *pend = SDATA (string) + best_above_byte; unsigned char *pbeg = pend - best_above_byte; unsigned char *p = pend - 1; int bytes; @@ -948,8 +948,8 @@ string_byte_to_char (string, byte_index) return byte_index; best_below = best_below_byte = 0; - best_above = XSTRING (string)->size; - best_above_byte = STRING_BYTES (XSTRING (string)); + best_above = SCHARS (string); + best_above_byte = SBYTES (string); if (EQ (string, string_char_byte_cache_string)) { @@ -980,7 +980,7 @@ string_byte_to_char (string, byte_index) { while (best_above_byte > byte_index) { - unsigned char *pend = XSTRING (string)->data + best_above_byte; + unsigned char *pend = SDATA (string) + best_above_byte; unsigned char *pbeg = pend - best_above_byte; unsigned char *p = pend - 1; int bytes; @@ -1020,18 +1020,18 @@ string_make_multibyte (string) if (STRING_MULTIBYTE (string)) return string; - nbytes = count_size_as_multibyte (XSTRING (string)->data, - XSTRING (string)->size); + nbytes = count_size_as_multibyte (SDATA (string), + SCHARS (string)); /* If all the chars are ASCII, they won't need any more bytes once converted. In that case, we can return STRING itself. */ - if (nbytes == STRING_BYTES (XSTRING (string))) + if (nbytes == SBYTES (string)) return string; buf = (unsigned char *) alloca (nbytes); - copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)), + copy_text (SDATA (string), buf, SBYTES (string), 0, 1); - return make_multibyte_string (buf, XSTRING (string)->size, nbytes); + return make_multibyte_string (buf, SCHARS (string), nbytes); } /* Convert STRING to a single-byte string. */ @@ -1045,12 +1045,12 @@ string_make_unibyte (string) if (! STRING_MULTIBYTE (string)) return string; - buf = (unsigned char *) alloca (XSTRING (string)->size); + buf = (unsigned char *) alloca (SCHARS (string)); - copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)), + copy_text (SDATA (string), buf, SBYTES (string), 1, 0); - return make_unibyte_string (buf, XSTRING (string)->size); + return make_unibyte_string (buf, SCHARS (string)); } DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte, @@ -1096,10 +1096,10 @@ corresponding single byte. */) if (STRING_MULTIBYTE (string)) { - int bytes = STRING_BYTES (XSTRING (string)); + int bytes = SBYTES (string); unsigned char *str = (unsigned char *) xmalloc (bytes); - bcopy (XSTRING (string)->data, str, bytes); + bcopy (SDATA (string), str, bytes); bytes = str_as_unibyte (str, bytes); string = make_unibyte_string (str, bytes); xfree (str); @@ -1125,17 +1125,17 @@ multibyte character of charset `eight-bit-control' or `eight-bit-graphic'. */) Lisp_Object new_string; int nchars, nbytes; - parse_str_as_multibyte (XSTRING (string)->data, - STRING_BYTES (XSTRING (string)), + parse_str_as_multibyte (SDATA (string), + SBYTES (string), &nchars, &nbytes); new_string = make_uninit_multibyte_string (nchars, nbytes); - bcopy (XSTRING (string)->data, XSTRING (new_string)->data, - STRING_BYTES (XSTRING (string))); - if (nbytes != STRING_BYTES (XSTRING (string))) - str_as_multibyte (XSTRING (new_string)->data, nbytes, - STRING_BYTES (XSTRING (string)), NULL); + bcopy (SDATA (string), SDATA (new_string), + SBYTES (string)); + if (nbytes != SBYTES (string)) + str_as_multibyte (SDATA (new_string), nbytes, + SBYTES (string), NULL); string = new_string; - XSTRING (string)->intervals = NULL_INTERVAL; + STRING_INTERVALS (string) = NULL_INTERVAL; } return string; } @@ -1190,8 +1190,8 @@ This function allows vectors as well as strings. */) if (STRINGP (string)) { - size = XSTRING (string)->size; - size_byte = STRING_BYTES (XSTRING (string)); + size = SCHARS (string); + size_byte = SBYTES (string); } else size = XVECTOR (string)->size; @@ -1225,7 +1225,7 @@ This function allows vectors as well as strings. */) if (STRINGP (string)) { - res = make_specified_string (XSTRING (string)->data + from_byte, + res = make_specified_string (SDATA (string) + from_byte, to_char - from_char, to_byte - from_byte, STRING_MULTIBYTE (string)); copy_text_properties (make_number (from_char), make_number (to_char), @@ -1257,8 +1257,8 @@ With one argument, just copy STRING without its properties. */) CHECK_STRING (string); - size = XSTRING (string)->size; - size_byte = STRING_BYTES (XSTRING (string)); + size = SCHARS (string); + size_byte = SBYTES (string); if (NILP (from)) from_char = from_byte = 0; @@ -1292,7 +1292,7 @@ With one argument, just copy STRING without its properties. */) args_out_of_range_3 (string, make_number (from_char), make_number (to_char)); - return make_specified_string (XSTRING (string)->data + from_byte, + return make_specified_string (SDATA (string) + from_byte, to_char - from_char, to_byte - from_byte, STRING_MULTIBYTE (string)); } @@ -1314,8 +1314,8 @@ substring_both (string, from, from_byte, to, to_byte) if (STRINGP (string)) { - size = XSTRING (string)->size; - size_byte = STRING_BYTES (XSTRING (string)); + size = SCHARS (string); + size_byte = SBYTES (string); } else size = XVECTOR (string)->size; @@ -1325,7 +1325,7 @@ substring_both (string, from, from_byte, to, to_byte) if (STRINGP (string)) { - res = make_specified_string (XSTRING (string)->data + from_byte, + res = make_specified_string (SDATA (string) + from_byte, to - from, to_byte - from_byte, STRING_MULTIBYTE (string)); copy_text_properties (make_number (from), make_number (to), @@ -1693,18 +1693,18 @@ to be sure of changing the value of `foo'. */) int c; for (i = nchars = nbytes = ibyte = 0; - i < XSTRING (seq)->size; + i < SCHARS (seq); ++i, ibyte += cbytes) { if (STRING_MULTIBYTE (seq)) { - c = STRING_CHAR (&XSTRING (seq)->data[ibyte], - STRING_BYTES (XSTRING (seq)) - ibyte); + c = STRING_CHAR (&SREF (seq, ibyte), + SBYTES (seq) - ibyte); cbytes = CHAR_BYTES (c); } else { - c = XSTRING (seq)->data[i]; + c = SREF (seq, i); cbytes = 1; } @@ -1715,34 +1715,34 @@ to be sure of changing the value of `foo'. */) } } - if (nchars != XSTRING (seq)->size) + if (nchars != SCHARS (seq)) { Lisp_Object tem; tem = make_uninit_multibyte_string (nchars, nbytes); if (!STRING_MULTIBYTE (seq)) - SET_STRING_BYTES (XSTRING (tem), -1); + STRING_SET_UNIBYTE (tem); for (i = nchars = nbytes = ibyte = 0; - i < XSTRING (seq)->size; + i < SCHARS (seq); ++i, ibyte += cbytes) { if (STRING_MULTIBYTE (seq)) { - c = STRING_CHAR (&XSTRING (seq)->data[ibyte], - STRING_BYTES (XSTRING (seq)) - ibyte); + c = STRING_CHAR (&SREF (seq, ibyte), + SBYTES (seq) - ibyte); cbytes = CHAR_BYTES (c); } else { - c = XSTRING (seq)->data[i]; + c = SREF (seq, i); cbytes = 1; } if (!INTEGERP (elt) || c != XINT (elt)) { - unsigned char *from = &XSTRING (seq)->data[ibyte]; - unsigned char *to = &XSTRING (tem)->data[nbytes]; + unsigned char *from = &SREF (seq, ibyte); + unsigned char *to = &SREF (tem, nbytes); EMACS_INT n; ++nchars; @@ -2176,12 +2176,12 @@ internal_equal (o1, o2, depth) break; case Lisp_String: - if (XSTRING (o1)->size != XSTRING (o2)->size) + if (SCHARS (o1) != SCHARS (o2)) return 0; - if (STRING_BYTES (XSTRING (o1)) != STRING_BYTES (XSTRING (o2))) + if (SBYTES (o1) != SBYTES (o2)) return 0; - if (bcmp (XSTRING (o1)->data, XSTRING (o2)->data, - STRING_BYTES (XSTRING (o1)))) + if (bcmp (SDATA (o1), SDATA (o2), + SBYTES (o1))) return 0; return 1; @@ -2221,15 +2221,15 @@ ARRAY is a vector, string, char-table, or bool-vector. */) } else if (STRINGP (array)) { - register unsigned char *p = XSTRING (array)->data; + register unsigned char *p = SDATA (array); CHECK_NUMBER (item); charval = XINT (item); - size = XSTRING (array)->size; + size = SCHARS (array); if (STRING_MULTIBYTE (array)) { unsigned char str[MAX_MULTIBYTE_LENGTH]; int len = CHAR_STRING (charval, str); - int size_byte = STRING_BYTES (XSTRING (array)); + int size_byte = SBYTES (array); unsigned char *p1 = p, *endp = p + size_byte; int i; @@ -3113,12 +3113,12 @@ is nil, and `use-dialog-box' is non-nil. */) ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, Qyes_or_no_p_history, Qnil, Qnil)); - if (XSTRING (ans)->size == 3 && !strcmp (XSTRING (ans)->data, "yes")) + if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes")) { UNGCPRO; return Qt; } - if (XSTRING (ans)->size == 2 && !strcmp (XSTRING (ans)->data, "no")) + if (SCHARS (ans) == 2 && !strcmp (SDATA (ans), "no")) { UNGCPRO; return Qnil; @@ -3257,7 +3257,7 @@ The normal messages at start and end of loading FILENAME are suppressed. */) of what files are preloaded and when. */ if (! NILP (Vpurify_flag)) error ("(require %s) while preparing to dump", - XSTRING (SYMBOL_NAME (feature))->data); + SDATA (SYMBOL_NAME (feature))); /* A certain amount of recursive `require' is legitimate, but if we require the same feature recursively 3 times, @@ -3271,7 +3271,7 @@ The normal messages at start and end of loading FILENAME are suppressed. */) } if (nesting > 2) error ("Recursive `require' for feature `%s'", - XSTRING (SYMBOL_NAME (feature))->data); + SDATA (SYMBOL_NAME (feature))); /* Update the list for any nested `require's that occur. */ record_unwind_protect (require_unwind, require_nesting_list); @@ -3294,7 +3294,7 @@ The normal messages at start and end of loading FILENAME are suppressed. */) tem = Fmemq (feature, Vfeatures); if (NILP (tem)) error ("Required feature `%s' was not provided", - XSTRING (SYMBOL_NAME (feature))->data); + SDATA (SYMBOL_NAME (feature))); /* Once loading finishes, don't undo it. */ Vautoload_queue = Qt; @@ -3557,7 +3557,7 @@ into shorter lines. */) /* We need to allocate enough room for encoding the text. We need 33 1/3% more space, plus a newline every 76 characters, and then we round up. */ - length = STRING_BYTES (XSTRING (string)); + length = SBYTES (string); allength = length + length/3 + 1; allength += allength / MIME_LINE_LENGTH + 1 + 6; @@ -3567,7 +3567,7 @@ into shorter lines. */) else encoded = (char *) xmalloc (allength); - encoded_length = base64_encode_1 (XSTRING (string)->data, + encoded_length = base64_encode_1 (SDATA (string), encoded, length, NILP (no_line_break), STRING_MULTIBYTE (string)); if (encoded_length > allength) @@ -3760,7 +3760,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, CHECK_STRING (string); - length = STRING_BYTES (XSTRING (string)); + length = SBYTES (string); /* We need to allocate enough room for decoding the text. */ if (length <= MAX_ALLOCA) decoded = (char *) alloca (length); @@ -3768,7 +3768,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, decoded = (char *) xmalloc (length); /* The decoded result should be unibyte. */ - decoded_length = base64_decode_1 (XSTRING (string)->data, decoded, length, + decoded_length = base64_decode_1 (SDATA (string), decoded, length, 0, NULL); if (decoded_length > length) abort (); @@ -4772,8 +4772,8 @@ sxhash (obj, depth) break; case Lisp_Symbol: - hash = sxhash_string (XSTRING (SYMBOL_NAME (obj))->data, - XSTRING (SYMBOL_NAME (obj))->size); + hash = sxhash_string (SDATA (SYMBOL_NAME (obj)), + SCHARS (SYMBOL_NAME (obj))); break; case Lisp_Misc: @@ -4781,7 +4781,7 @@ sxhash (obj, depth) break; case Lisp_String: - hash = sxhash_string (XSTRING (obj)->data, XSTRING (obj)->size); + hash = sxhash_string (SDATA (obj), SCHARS (obj)); break; /* This can be everything from a vector to an overlay. */ @@ -5206,8 +5206,8 @@ guesswork fails. Normally, an error is signaled in such case. */) if (STRING_MULTIBYTE (object)) object = code_convert_string1 (object, coding_system, Qnil, 1); - size = XSTRING (object)->size; - size_byte = STRING_BYTES (XSTRING (object)); + size = SCHARS (object); + size_byte = SBYTES (object); if (!NILP (start)) { @@ -5339,8 +5339,8 @@ guesswork fails. Normally, an error is signaled in such case. */) object = code_convert_string1 (object, coding_system, Qnil, 1); } - md5_buffer (XSTRING (object)->data + start_byte, - STRING_BYTES(XSTRING (object)) - (size_byte - end_byte), + md5_buffer (SDATA (object) + start_byte, + SBYTES (object) - (size_byte - end_byte), digest); for (i = 0; i < 16; i++) diff --git a/src/fontset.c b/src/fontset.c index f2df1c63774..a69ae807af6 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -370,7 +370,7 @@ font_family_registry (fontname, force) int force; { Lisp_Object family, registry; - char *p = XSTRING (fontname)->data; + char *p = SDATA (fontname); char *sep[15]; int i = 0; @@ -557,7 +557,7 @@ fontset_font_pattern (f, id, c) font name. */ elt = XCDR (elt); xassert (STRINGP (elt)); - fontp = FS_LOAD_FONT (f, c, XSTRING (elt)->data, -1); + fontp = FS_LOAD_FONT (f, c, SDATA (elt), -1); if (!fontp) return Qnil; @@ -616,7 +616,7 @@ fs_load_font (f, c, fontname, id, face) if (!fontname && charset == CHARSET_ASCII) { elt = FONTSET_ASCII (fontset); - fontname = XSTRING (XCDR (elt))->data; + fontname = SDATA (XCDR (elt)); } } @@ -705,7 +705,7 @@ fs_load_font (f, c, fontname, id, face) the corresponding regular expression. */ static Lisp_Object Vcached_fontset_data; -#define CACHED_FONTSET_NAME (XSTRING (XCAR (Vcached_fontset_data))->data) +#define CACHED_FONTSET_NAME (SDATA (XCAR (Vcached_fontset_data))) #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data)) /* If fontset name PATTERN contains any wild card, return regular @@ -715,21 +715,21 @@ static Lisp_Object fontset_pattern_regexp (pattern) Lisp_Object pattern; { - if (!index (XSTRING (pattern)->data, '*') - && !index (XSTRING (pattern)->data, '?')) + if (!index (SDATA (pattern), '*') + && !index (SDATA (pattern), '?')) /* PATTERN does not contain any wild cards. */ return Qnil; if (!CONSP (Vcached_fontset_data) - || strcmp (XSTRING (pattern)->data, CACHED_FONTSET_NAME)) + || strcmp (SDATA (pattern), CACHED_FONTSET_NAME)) { /* We must at first update the cached data. */ - char *regex = (char *) alloca (XSTRING (pattern)->size * 2 + 3); + char *regex = (char *) alloca (SCHARS (pattern) * 2 + 3); char *p0, *p1 = regex; /* Convert "*" to ".*", "?" to ".". */ *p1++ = '^'; - for (p0 = (char *) XSTRING (pattern)->data; *p0; p0++) + for (p0 = (char *) SDATA (pattern); *p0; p0++) { if (*p0 == '*') { @@ -744,7 +744,7 @@ fontset_pattern_regexp (pattern) *p1++ = '$'; *p1++ = 0; - Vcached_fontset_data = Fcons (build_string (XSTRING (pattern)->data), + Vcached_fontset_data = Fcons (build_string (SDATA (pattern)), build_string (regex)); } @@ -789,10 +789,10 @@ fs_query_fontset (name, regexpp) || !BASE_FONTSET_P (fontset)) continue; - this_name = XSTRING (FONTSET_NAME (fontset))->data; + this_name = SDATA (FONTSET_NAME (fontset)); if (regexpp ? fast_c_string_match_ignore_case (name, this_name) >= 0 - : !strcmp (XSTRING (name)->data, this_name)) + : !strcmp (SDATA (name), this_name)) return i; } return -1; @@ -815,7 +815,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression. */) CHECK_STRING (pattern); - if (XSTRING (pattern)->size == 0) + if (SCHARS (pattern) == 0) return Qnil; id = fs_query_fontset (pattern, !NILP (regexpp)); @@ -854,11 +854,11 @@ list_fontsets (f, pattern, size) || !BASE_FONTSET_P (fontset) || !EQ (frame, FONTSET_FRAME (fontset))) continue; - name = XSTRING (FONTSET_NAME (fontset))->data; + name = SDATA (FONTSET_NAME (fontset)); if (!NILP (regexp) ? (fast_c_string_match_ignore_case (regexp, name) < 0) - : strcmp (XSTRING (pattern)->data, name)) + : strcmp (SDATA (pattern), name)) continue; if (size) @@ -892,7 +892,7 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */) tem = Fquery_fontset (name, Qnil); if (!NILP (tem)) error ("Fontset `%s' matches the existing fontset `%s'", - XSTRING (name)->data, XSTRING (tem)->data); + SDATA (name), SDATA (tem)); /* Check the validity of FONTLIST while creating a template for fontset elements. */ @@ -969,7 +969,7 @@ check_fontset_name (name) CHECK_STRING (name); id = fs_query_fontset (name, 0); if (id < 0) - error ("Fontset `%s' does not exist", XSTRING (name)->data); + error ("Fontset `%s' does not exist", SDATA (name)); return FONTSET_FROM_ID (id); } @@ -1120,7 +1120,7 @@ If the named font is not yet loaded, return nil. */) if (!query_font_func) error ("Font query function is not supported"); - fontp = (*query_font_func) (f, XSTRING (name)->data); + fontp = (*query_font_func) (f, SDATA (name)); if (!fontp) return Qnil; @@ -1338,7 +1338,7 @@ If FRAME is omitted, it defaults to the currently selected frame. */) if (CONSP (elt)) { elt = XCAR (elt); - fontp = (*query_font_func) (f, XSTRING (elt)->data); + fontp = (*query_font_func) (f, SDATA (elt)); } val = Fmake_vector (make_number (3), val); AREF (val, 0) = fontp ? make_number (fontp->size) : make_number (0); diff --git a/src/frame.c b/src/frame.c index 9c3ac13e3b9..d659740e2f4 100644 --- a/src/frame.c +++ b/src/frame.c @@ -293,7 +293,7 @@ make_frame (mini_p) buf = Fcurrent_buffer (); /* If buf is a 'hidden' buffer (i.e. one whose name starts with a space), try to find another one. */ - if (XSTRING (Fbuffer_name (buf))->data[0] == ' ') + if (SREF (Fbuffer_name (buf), 0) == ' ') buf = Fother_buffer (buf, Qnil, Qnil); /* Use set_window_buffer, not Fset_window_buffer, and don't let @@ -1115,7 +1115,7 @@ frame. The hook is called with one argument FRAME. */) #ifdef MAC_OS8 /* Terminal frame deleted before any other visible frames are created. */ - && strcmp (XSTRING (f->name)->data, "F1") != 0 + && strcmp (SDATA (f->name), "F1") != 0 #endif ) error ("Attempt to delete the sole visible or iconified frame"); @@ -1869,8 +1869,8 @@ set_term_frame_name (f, name) /* Check for no change needed in this very common case before we do any consing. */ - if (frame_name_fnn_p (XSTRING (f->name)->data, - STRING_BYTES (XSTRING (f->name)))) + if (frame_name_fnn_p (SDATA (f->name), + SBYTES (f->name))) return; terminal_frame_count++; @@ -1887,7 +1887,7 @@ set_term_frame_name (f, name) /* Don't allow the user to set the frame name to F<num>, so it doesn't clash with the names we generate for terminal frames. */ - if (frame_name_fnn_p (XSTRING (name)->data, STRING_BYTES (XSTRING (name)))) + if (frame_name_fnn_p (SDATA (name), SBYTES (name))) error ("Frame names of the form F<num> are usurped by Emacs"); } @@ -2005,13 +2005,13 @@ If FRAME is omitted, return information on the currently selected frame. */) elt = Fassq (Qforeground_color, alist); if (!NILP (elt) && CONSP (elt) && STRINGP (XCDR (elt))) { - if (strncmp (XSTRING (XCDR (elt))->data, + if (strncmp (SDATA (XCDR (elt)), unspecified_bg, - XSTRING (XCDR (elt))->size) == 0) + SCHARS (XCDR (elt))) == 0) store_in_alist (&alist, Qforeground_color, tty_color_name (f, bg)); - else if (strncmp (XSTRING (XCDR (elt))->data, + else if (strncmp (SDATA (XCDR (elt)), unspecified_fg, - XSTRING (XCDR (elt))->size) == 0) + SCHARS (XCDR (elt))) == 0) store_in_alist (&alist, Qforeground_color, tty_color_name (f, fg)); } else @@ -2019,13 +2019,13 @@ If FRAME is omitted, return information on the currently selected frame. */) elt = Fassq (Qbackground_color, alist); if (!NILP (elt) && CONSP (elt) && STRINGP (XCDR (elt))) { - if (strncmp (XSTRING (XCDR (elt))->data, + if (strncmp (SDATA (XCDR (elt)), unspecified_fg, - XSTRING (XCDR (elt))->size) == 0) + SCHARS (XCDR (elt))) == 0) store_in_alist (&alist, Qbackground_color, tty_color_name (f, fg)); - else if (strncmp (XSTRING (XCDR (elt))->data, + else if (strncmp (SDATA (XCDR (elt)), unspecified_bg, - XSTRING (XCDR (elt))->size) == 0) + SCHARS (XCDR (elt))) == 0) store_in_alist (&alist, Qbackground_color, tty_color_name (f, bg)); } else @@ -2112,8 +2112,8 @@ If FRAME is nil, describe the currently selected frame. */) if (EQ (parameter, Qbackground_color)) { - color_name = XSTRING (value)->data; - csz = XSTRING (value)->size; + color_name = SDATA (value); + csz = SCHARS (value); if (strncmp (color_name, unspecified_bg, csz) == 0) value = tty_color_name (f, FRAME_BACKGROUND_PIXEL (f)); else if (strncmp (color_name, unspecified_fg, csz) == 0) @@ -2121,8 +2121,8 @@ If FRAME is nil, describe the currently selected frame. */) } else if (EQ (parameter, Qforeground_color)) { - color_name = XSTRING (value)->data; - csz = XSTRING (value)->size; + color_name = SDATA (value); + csz = SCHARS (value); if (strncmp (color_name, unspecified_fg, csz) == 0) value = tty_color_name (f, FRAME_FOREGROUND_PIXEL (f)); else if (strncmp (color_name, unspecified_bg, csz) == 0) diff --git a/src/indent.c b/src/indent.c index ae1f68806d3..b6cf76234e3 100644 --- a/src/indent.c +++ b/src/indent.c @@ -667,7 +667,7 @@ string_display_width (string, beg, end) int b, e; if (NILP (end)) - e = XSTRING (string)->size; + e = SCHARS (string); else { CHECK_NUMBER (end); @@ -683,10 +683,10 @@ string_display_width (string, beg, end) } /* Make a pointer for decrementing through the chars before point. */ - ptr = XSTRING (string)->data + e; + ptr = SDATA (string) + e; /* Make a pointer to where consecutive chars leave off, going backwards from point. */ - stop = XSTRING (string)->data + b; + stop = SDATA (string) + b; if (tab_width <= 0 || tab_width > 1000) tab_width = 8; diff --git a/src/insdel.c b/src/insdel.c index 1028bc40c4a..9639adbf0fd 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1111,7 +1111,7 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes, outgoing_nbytes = nchars; else if (! STRING_MULTIBYTE (string)) outgoing_nbytes - = count_size_as_multibyte (&XSTRING (string)->data[pos_byte], + = count_size_as_multibyte (&SREF (string, pos_byte), nbytes); GCPRO1 (string); @@ -1128,7 +1128,7 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes, /* Copy the string text into the buffer, perhaps converting between single-byte and multibyte. */ - copy_text (XSTRING (string)->data + pos_byte, GPT_ADDR, nbytes, + copy_text (SDATA (string) + pos_byte, GPT_ADDR, nbytes, STRING_MULTIBYTE (string), ! NILP (current_buffer->enable_multibyte_characters)); @@ -1169,9 +1169,9 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes, offset_intervals (current_buffer, PT, nchars); - intervals = XSTRING (string)->intervals; + intervals = STRING_INTERVALS (string); /* Get the intervals for the part of the string we are inserting. */ - if (nbytes < STRING_BYTES (XSTRING (string))) + if (nbytes < SBYTES (string)) intervals = copy_intervals (intervals, pos, nchars); /* Insert those intervals. */ @@ -1358,8 +1358,8 @@ adjust_after_replace (from, from_byte, prev_text, len, len_byte) if (STRINGP (prev_text)) { - nchars_del = XSTRING (prev_text)->size; - nbytes_del = STRING_BYTES (XSTRING (prev_text)); + nchars_del = SCHARS (prev_text); + nbytes_del = SBYTES (prev_text); } /* Update various buffer positions for the new text. */ @@ -1493,8 +1493,8 @@ replace_range (from, to, new, prepare, inherit, markers) Lisp_Object new; int from, to, prepare, inherit, markers; { - int inschars = XSTRING (new)->size; - int insbytes = STRING_BYTES (XSTRING (new)); + int inschars = SCHARS (new); + int insbytes = SBYTES (new); int from_byte, to_byte; int nbytes_del, nchars_del; register Lisp_Object temp; @@ -1539,7 +1539,7 @@ replace_range (from, to, new, prepare, inherit, markers) outgoing_insbytes = inschars; else if (! STRING_MULTIBYTE (new)) outgoing_insbytes - = count_size_as_multibyte (XSTRING (new)->data, insbytes); + = count_size_as_multibyte (SDATA (new), insbytes); /* Make sure point-max won't overflow after this insertion. */ XSETINT (temp, Z_BYTE - nbytes_del + insbytes); @@ -1582,7 +1582,7 @@ replace_range (from, to, new, prepare, inherit, markers) /* Copy the string text into the buffer, perhaps converting between single-byte and multibyte. */ - copy_text (XSTRING (new)->data, GPT_ADDR, insbytes, + copy_text (SDATA (new), GPT_ADDR, insbytes, STRING_MULTIBYTE (new), ! NILP (current_buffer->enable_multibyte_characters)); @@ -1629,7 +1629,7 @@ replace_range (from, to, new, prepare, inherit, markers) /* Get the intervals for the part of the string we are inserting-- not including the combined-before bytes. */ - intervals = XSTRING (new)->intervals; + intervals = STRING_INTERVALS (new); /* Insert those intervals. */ graft_intervals_into_buffer (intervals, from, inschars, current_buffer, inherit); diff --git a/src/intervals.c b/src/intervals.c index bec97d0b3e6..0129faa7877 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -80,8 +80,8 @@ create_root_interval (parent) } else if (STRINGP (parent)) { - new->total_length = XSTRING (parent)->size; - XSTRING (parent)->intervals = new; + new->total_length = SCHARS (parent); + STRING_INTERVALS (parent) = new; new->position = 0; } @@ -452,7 +452,7 @@ balance_possible_root_interval (interval) if (BUFFERP (parent)) BUF_INTERVALS (XBUFFER (parent)) = interval; else if (STRINGP (parent)) - XSTRING (parent)->intervals = interval; + STRING_INTERVALS (parent) = interval; } return interval; @@ -1280,7 +1280,7 @@ delete_interval (i) if (BUFFERP (owner)) BUF_INTERVALS (XBUFFER (owner)) = parent; else if (STRINGP (owner)) - XSTRING (owner)->intervals = parent; + STRING_INTERVALS (owner) = parent; else abort (); @@ -2247,7 +2247,7 @@ get_property_and_range (pos, prop, val, start, end, object) else if (BUFFERP (object)) i = find_interval (BUF_INTERVALS (XBUFFER (object)), pos); else if (STRINGP (object)) - i = find_interval (XSTRING (object)->intervals, pos); + i = find_interval (STRING_INTERVALS (object), pos); else abort (); @@ -2384,7 +2384,7 @@ copy_intervals_to_string (string, buffer, position, length) return; SET_INTERVAL_OBJECT (interval_copy, string); - XSTRING (string)->intervals = interval_copy; + STRING_INTERVALS (string) = interval_copy; } /* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. @@ -2396,10 +2396,10 @@ compare_string_intervals (s1, s2) { INTERVAL i1, i2; int pos = 0; - int end = XSTRING (s1)->size; + int end = SCHARS (s1); - i1 = find_interval (XSTRING (s1)->intervals, 0); - i2 = find_interval (XSTRING (s2)->intervals, 0); + i1 = find_interval (STRING_INTERVALS (s1), 0); + i2 = find_interval (STRING_INTERVALS (s2), 0); while (pos < end) { diff --git a/src/keyboard.c b/src/keyboard.c index 6006d9276ac..26c1e8ffddb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -855,7 +855,7 @@ echo_now () echoing = 1; message3_nolog (current_kboard->echo_string, SBYTES (current_kboard->echo_string), - SMBP (current_kboard->echo_string)); + STRING_MULTIBYTE (current_kboard->echo_string)); echoing = 0; /* Record in what buffer we echoed, and from which kboard. */ @@ -1204,7 +1204,7 @@ cmd_error_internal (data, context) *Messages*. */ if (!NILP (Vsignaling_function) && SYMBOLP (Vsignaling_function)) { - char *name = XSTRING (SYMBOL_NAME (Vsignaling_function))->data; + char *name = SDATA (SYMBOL_NAME (Vsignaling_function)); message_dolog (name, strlen (name), 0, 0); message_dolog (": ", 2, 0, 0); Vsignaling_function = Qnil; @@ -2111,14 +2111,14 @@ show_help_echo (help, window, object, pos, ok_to_overwrite_keystroke_echo) Vpre_help_message = current_message (); specbind (Qmessage_truncate_lines, Qt); - message3_nolog (help, STRING_BYTES (XSTRING (help)), + message3_nolog (help, SBYTES (help), STRING_MULTIBYTE (help)); unbind_to (count, Qnil); } else if (STRINGP (Vpre_help_message)) { message3_nolog (Vpre_help_message, - STRING_BYTES (XSTRING (Vpre_help_message)), + SBYTES (Vpre_help_message), STRING_MULTIBYTE (Vpre_help_message)); Vpre_help_message = Qnil; } @@ -2745,7 +2745,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) RETURN_UNGCPRO (c); if ((STRINGP (Vkeyboard_translate_table) - && XSTRING (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) + && SCHARS (Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) || (VECTORP (Vkeyboard_translate_table) && XVECTOR (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) || (CHAR_TABLE_P (Vkeyboard_translate_table) @@ -3161,8 +3161,8 @@ record_char (c) if (SYMBOLP (dribblee)) { putc ('<', dribble); - fwrite (XSTRING (SYMBOL_NAME (dribblee))->data, sizeof (char), - STRING_BYTES (XSTRING (SYMBOL_NAME (dribblee))), + fwrite (SDATA (SYMBOL_NAME (dribblee)), sizeof (char), + SBYTES (SYMBOL_NAME (dribblee)), dribble); putc ('>', dribble); } @@ -4929,7 +4929,7 @@ make_lispy_event (event) if (NILP (string)) break; if (column >= XINT (pos) - && column < XINT (pos) + XSTRING (string)->size) + && column < XINT (pos) + SCHARS (string)) { item = AREF (items, i); break; @@ -5703,8 +5703,8 @@ apply_modifiers_uncached (modifiers, base, base_len, base_len_byte) new_name = make_uninit_multibyte_string (mod_len + base_len, mod_len + base_len_byte); - bcopy (new_mods, XSTRING (new_name)->data, mod_len); - bcopy (base, XSTRING (new_name)->data + mod_len, base_len_byte); + bcopy (new_mods, SDATA (new_name), mod_len); + bcopy (base, SDATA (new_name) + mod_len, base_len_byte); return Fintern (new_name, Qnil); } @@ -5762,8 +5762,8 @@ parse_modifiers (symbol) Lisp_Object unmodified; Lisp_Object mask; - unmodified = Fintern (make_string (XSTRING (SYMBOL_NAME (symbol))->data + end, - STRING_BYTES (XSTRING (SYMBOL_NAME (symbol))) - end), + unmodified = Fintern (make_string (SDATA (SYMBOL_NAME (symbol)) + end, + SBYTES (SYMBOL_NAME (symbol)) - end), Qnil); if (modifiers & ~VALMASK) @@ -5816,9 +5816,9 @@ apply_modifiers (modifiers, base) { /* We have to create the symbol ourselves. */ new_symbol = apply_modifiers_uncached (modifiers, - XSTRING (SYMBOL_NAME (base))->data, - XSTRING (SYMBOL_NAME (base))->size, - STRING_BYTES (XSTRING (SYMBOL_NAME (base)))); + SDATA (SYMBOL_NAME (base)), + SCHARS (SYMBOL_NAME (base)), + SBYTES (SYMBOL_NAME (base))); /* Add the new symbol to the base's cache. */ entry = Fcons (index, new_symbol); @@ -5956,9 +5956,9 @@ modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem, value = Fcdr_safe (Fassq (symbol_int, name_alist_or_stem)); else if (STRINGP (name_alist_or_stem)) { - int len = STRING_BYTES (XSTRING (name_alist_or_stem)); + int len = SBYTES (name_alist_or_stem); char *buf = (char *) alloca (len + 50); - sprintf (buf, "%s-%d", XSTRING (name_alist_or_stem)->data, + sprintf (buf, "%s-%d", SDATA (name_alist_or_stem), XINT (symbol_int) + 1); value = intern (buf); } @@ -6039,8 +6039,8 @@ has the same base event type and all the specified modifiers. */) } /* Let the symbol A refer to the character A. */ - if (SYMBOLP (base) && XSTRING (SYMBOL_NAME (base))->size == 1) - XSETINT (base, XSTRING (SYMBOL_NAME (base))->data[0]); + if (SYMBOLP (base) && SCHARS (SYMBOL_NAME (base)) == 1) + XSETINT (base, SDATA (SYMBOL_NAME (base))[0]); if (INTEGERP (base)) { @@ -7720,8 +7720,8 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) return Qnil; /* Prompt string always starts with map's prompt, and a space. */ - strcpy (menu, XSTRING (name)->data); - nlength = STRING_BYTES (XSTRING (name)); + strcpy (menu, SDATA (name)); + nlength = SBYTES (name); menu[nlength++] = ':'; menu[nlength++] = ' '; menu[nlength] = 0; @@ -7799,8 +7799,8 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) upcased_event = Fupcase (event); downcased_event = Fdowncase (event); - char_matches = (XINT (upcased_event) == XSTRING (s)->data[0] - || XINT (downcased_event) == XSTRING (s)->data[0]); + char_matches = (XINT (upcased_event) == SREF (s, 0) + || XINT (downcased_event) == SREF (s, 0)); if (! char_matches) desc = Fsingle_key_description (event, Qnil); @@ -7829,8 +7829,8 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) /* If we have room for the prompt string, add it to this line. If this is the first on the line, always add it. */ - if ((XSTRING (s)->size + i + 2 - + (char_matches ? 0 : XSTRING (desc)->size + 3)) + if ((SCHARS (s) + i + 2 + + (char_matches ? 0 : SCHARS (desc) + 3)) < width || !notfirst) { @@ -7850,20 +7850,20 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps) if (! char_matches) { /* Add as much of string as fits. */ - thiswidth = XSTRING (desc)->size; + thiswidth = SCHARS (desc); if (thiswidth + i > width) thiswidth = width - i; - bcopy (XSTRING (desc)->data, menu + i, thiswidth); + bcopy (SDATA (desc), menu + i, thiswidth); i += thiswidth; strcpy (menu + i, " = "); i += 3; } /* Add as much of string as fits. */ - thiswidth = XSTRING (s)->size; + thiswidth = SCHARS (s); if (thiswidth + i > width) thiswidth = width - i; - bcopy (XSTRING (s)->data, menu + i, thiswidth); + bcopy (SDATA (s), menu + i, thiswidth); i += thiswidth; menu[i] = 0; } @@ -8594,7 +8594,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, pos = XCDR (string); string = XCAR (string); if (XINT (pos) >= 0 - && XINT (pos) < XSTRING (string)->size) + && XINT (pos) < SCHARS (string)) { map = Fget_text_property (pos, Qlocal_map, string); if (!NILP (map)) @@ -8622,7 +8622,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, pos = XCDR (string); string = XCAR (string); if (XINT (pos) >= 0 - && XINT (pos) < XSTRING (string)->size) + && XINT (pos) < SCHARS (string)) { map = Fget_text_property (pos, Qlocal_map, string); if (!NILP (map)) @@ -8923,7 +8923,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, for (i = 0; i < len; i++) XSETFASTINT (keybuf[fkey_start + i], - XSTRING (fkey_next)->data[i]); + SREF (fkey_next, i)); } mock_input = t; @@ -9462,7 +9462,7 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ Qt, Qnil, Qextended_command_history, Qnil, Qnil); - if (STRINGP (function) && XSTRING (function)->size == 0) + if (STRINGP (function) && SCHARS (function) == 0) error ("No command name given"); /* Set this_command_keys to the concatenation of saved_keys and @@ -9538,12 +9538,12 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_ binding = Fkey_description (bindings); newmessage - = (char *) alloca (XSTRING (SYMBOL_NAME (function))->size - + STRING_BYTES (XSTRING (binding)) + = (char *) alloca (SCHARS (SYMBOL_NAME (function)) + + SBYTES (binding) + 100); sprintf (newmessage, "You can run the command `%s' with %s", - XSTRING (SYMBOL_NAME (function))->data, - XSTRING (binding)->data); + SDATA (SYMBOL_NAME (function)), + SDATA (binding)); message2_nolog (newmessage, strlen (newmessage), STRING_MULTIBYTE (binding)); @@ -9769,7 +9769,7 @@ If FILE is nil, close any open dribble file. */) if (!NILP (file)) { file = Fexpand_file_name (file, Qnil); - dribble = fopen (XSTRING (file)->data, "w"); + dribble = fopen (SDATA (file), "w"); if (dribble == 0) report_file_error ("Opening dribble", Fcons (file, Qnil)); } @@ -9869,8 +9869,8 @@ stuff_buffered_input (stuffstring) { register int count; - p = XSTRING (stuffstring)->data; - count = STRING_BYTES (XSTRING (stuffstring)); + p = SDATA (stuffstring); + count = SBYTES (stuffstring); while (count-- > 0) stuff_char (*p++); stuff_char ('\n'); diff --git a/src/keymap.c b/src/keymap.c index 467b5119b98..21c3bbdc232 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1062,7 +1062,7 @@ the front of KEYMAP. */) /* We must use Fkey_description rather than just passing key to error; key might be a vector, not a string. */ error ("Key sequence %s uses invalid prefix characters", - XSTRING (Fkey_description (key))->data); + SDATA (Fkey_description (key))); } } @@ -1223,8 +1223,8 @@ silly_event_symbol_error (c) error ((modifiers & ~meta_modifier ? "To bind the key %s, use [?%s], not [%s]" : "To bind the key %s, use \"%s\", not [%s]"), - XSTRING (SYMBOL_NAME (c))->data, XSTRING (keystring)->data, - XSTRING (SYMBOL_NAME (c))->data); + SDATA (SYMBOL_NAME (c)), SDATA (keystring), + SDATA (SYMBOL_NAME (c))); } } @@ -1746,8 +1746,8 @@ then the value includes only maps for prefixes that start with PREFIX. */) int i, i_byte, c; Lisp_Object copy; - copy = Fmake_vector (make_number (XSTRING (prefix)->size), Qnil); - for (i = 0, i_byte = 0; i < XSTRING (prefix)->size;) + copy = Fmake_vector (make_number (SCHARS (prefix)), Qnil); + for (i = 0, i_byte = 0; i < SCHARS (prefix);) { int i_before = i; @@ -1876,7 +1876,7 @@ spaces are put between sequence elements, etc. */) { Lisp_Object vector; vector = Fmake_vector (Flength (keys), Qnil); - for (i = 0, i_byte = 0; i < XSTRING (keys)->size; ) + for (i = 0, i_byte = 0; i < SCHARS (keys); ) { int c; int i_before = i; @@ -2120,8 +2120,8 @@ around function keys and event symbols. */) if (NILP (no_angles)) { char *buffer - = (char *) alloca (STRING_BYTES (XSTRING (SYMBOL_NAME (key))) + 5); - sprintf (buffer, "<%s>", XSTRING (SYMBOL_NAME (key))->data); + = (char *) alloca (SBYTES (SYMBOL_NAME (key)) + 5); + sprintf (buffer, "<%s>", SDATA (SYMBOL_NAME (key))); return build_string (buffer); } else @@ -2659,8 +2659,8 @@ You type Translation\n\ if (STRINGP (Vkeyboard_translate_table) && !NILP (prefix)) { int c; - unsigned char *translate = XSTRING (Vkeyboard_translate_table)->data; - int translate_len = XSTRING (Vkeyboard_translate_table)->size; + unsigned char *translate = SDATA (Vkeyboard_translate_table); + int translate_len = SCHARS (Vkeyboard_translate_table); for (c = 0; c < translate_len; c++) if (translate[c] != c) @@ -2738,13 +2738,13 @@ You type Translation\n\ if (!SYMBOLP (modes[i])) abort(); - p = title = (char *) alloca (42 + XSTRING (SYMBOL_NAME (modes[i]))->size); + p = title = (char *) alloca (42 + SCHARS (SYMBOL_NAME (modes[i]))); *p++ = '\f'; *p++ = '\n'; *p++ = '`'; - bcopy (XSTRING (SYMBOL_NAME (modes[i]))->data, p, - XSTRING (SYMBOL_NAME (modes[i]))->size); - p += XSTRING (SYMBOL_NAME (modes[i]))->size; + bcopy (SDATA (SYMBOL_NAME (modes[i])), p, + SCHARS (SYMBOL_NAME (modes[i]))); + p += SCHARS (SYMBOL_NAME (modes[i])); *p++ = '\''; bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1); p += sizeof (" Minor Mode Bindings") - 1; @@ -2875,7 +2875,7 @@ key binding\n\ /* If the sequence by which we reach this keymap is zero-length, then the shadow map for this keymap is just SHADOW. */ - if ((STRINGP (prefix) && XSTRING (prefix)->size == 0) + if ((STRINGP (prefix) && SCHARS (prefix) == 0) || (VECTORP (prefix) && XVECTOR (prefix)->size == 0)) ; /* If the sequence by which we reach this keymap actually has @@ -3361,8 +3361,8 @@ describe_vector (vector, elt_prefix, args, elt_describer, insert_string ("<"); tem2 = CHARSET_TABLE_INFO (i - 128, CHARSET_SHORT_NAME_IDX); if (STRINGP (tem2)) - insert_from_string (tem2, 0, 0, XSTRING (tem2)->size, - STRING_BYTES (XSTRING (tem2)), 0); + insert_from_string (tem2, 0, 0, SCHARS (tem2), + SBYTES (tem2), 0); else insert ("?", 1); insert (">", 1); diff --git a/src/lread.c b/src/lread.c index aaab4fd8f64..6900e337c7c 100644 --- a/src/lread.c +++ b/src/lread.c @@ -695,9 +695,9 @@ Return t if file exists. */) /* Avoid weird lossage with null string as arg, since it would try to load a directory as a Lisp file */ - if (XSTRING (file)->size > 0) + if (SCHARS (file) > 0) { - int size = STRING_BYTES (XSTRING (file)); + int size = SBYTES (file); Lisp_Object tmp[2]; GCPRO1 (file); @@ -706,10 +706,10 @@ Return t if file exists. */) { /* Don't insist on adding a suffix if FILE already ends with one. */ if (size > 3 - && !strcmp (XSTRING (file)->data + size - 3, ".el")) + && !strcmp (SDATA (file) + size - 3, ".el")) must_suffix = Qnil; else if (size > 4 - && !strcmp (XSTRING (file)->data + size - 4, ".elc")) + && !strcmp (SDATA (file) + size - 4, ".elc")) must_suffix = Qnil; /* Don't insist on adding a suffix if the argument includes a directory name. */ @@ -778,7 +778,7 @@ Return t if file exists. */) Vloads_in_progress = Fcons (found, Vloads_in_progress); } - if (!bcmp (&(XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 4]), + if (!bcmp (&(SREF (found, SBYTES (found) - 4)), ".elc", 4)) /* Load .elc files directly, but not when they are remote and have no handler! */ @@ -793,7 +793,7 @@ Return t if file exists. */) safe_p = 0; if (!load_dangerous_libraries) error ("File `%s' was not compiled in Emacs", - XSTRING (found)->data); + SDATA (found)); else if (!NILP (nomessage)) message_with_string ("File `%s' not compiled in Emacs", found, 1); } @@ -806,10 +806,10 @@ Return t if file exists. */) #ifdef DOS_NT fmode = "rb"; #endif /* DOS_NT */ - stat ((char *)XSTRING (efound)->data, &s1); - XSTRING (efound)->data[STRING_BYTES (XSTRING (efound)) - 1] = 0; - result = stat ((char *)XSTRING (efound)->data, &s2); - XSTRING (efound)->data[STRING_BYTES (XSTRING (efound)) - 1] = 'c'; + stat ((char *)SDATA (efound), &s1); + SREF (efound, SBYTES (efound) - 1) = 0; + result = stat ((char *)SDATA (efound), &s2); + SREF (efound, SBYTES (efound) - 1) = 'c'; UNGCPRO; if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime) @@ -823,7 +823,7 @@ Return t if file exists. */) Lisp_Object file; file = Fsubstring (found, make_number (0), make_number (-1)); message_with_string ("Source file `%s' newer than byte-compiled file", - file, SMBP (file)); + file, STRING_MULTIBYTE (file)); } } } @@ -848,7 +848,7 @@ Return t if file exists. */) emacs_close (fd); GCPRO1 (efound); efound = ENCODE_FILE (found); - stream = fopen ((char *) XSTRING (efound)->data, fmode); + stream = fopen ((char *) SDATA (efound), fmode); UNGCPRO; #else /* not WINDOWSNT */ stream = fdopen (fd, fmode); @@ -856,7 +856,7 @@ Return t if file exists. */) if (stream == 0) { emacs_close (fd); - error ("Failure to create stdio stream for %s", XSTRING (file)->data); + error ("Failure to create stdio stream for %s", SDATA (file)); } if (! NILP (Vpurify_flag)) @@ -958,9 +958,9 @@ static int complete_filename_p (pathname) Lisp_Object pathname; { - register unsigned char *s = XSTRING (pathname)->data; + register unsigned char *s = SDATA (pathname); return (IS_DIRECTORY_SEP (s[0]) - || (XSTRING (pathname)->size > 2 + || (SCHARS (pathname) > 2 && IS_DEVICE_SEP (s[1]) && IS_DIRECTORY_SEP (s[2])) #ifdef ALTOS || *s == '@' @@ -1032,7 +1032,7 @@ openp (path, str, suffixes, storeptr, predicate) { CHECK_STRING_CAR (tail); max_suffix_len = max (max_suffix_len, - STRING_BYTES (XSTRING (XCAR (tail)))); + SBYTES (XCAR (tail))); } string = filename = Qnil; @@ -1060,7 +1060,7 @@ openp (path, str, suffixes, storeptr, predicate) /* Calculate maximum size of any filename made from this path element/specified file name and any possible suffix. */ - want_size = max_suffix_len + STRING_BYTES (XSTRING (filename)) + 1; + want_size = max_suffix_len + SBYTES (filename) + 1; if (fn_size < want_size) fn = (char *) alloca (fn_size = 100 + want_size); @@ -1068,29 +1068,29 @@ openp (path, str, suffixes, storeptr, predicate) for (tail = NILP (suffixes) ? default_suffixes : suffixes; CONSP (tail); tail = XCDR (tail)) { - int lsuffix = STRING_BYTES (XSTRING (XCAR (tail))); + int lsuffix = SBYTES (XCAR (tail)); Lisp_Object handler; int exists; /* Concatenate path element/specified name with the suffix. If the directory starts with /:, remove that. */ - if (XSTRING (filename)->size > 2 - && XSTRING (filename)->data[0] == '/' - && XSTRING (filename)->data[1] == ':') + if (SCHARS (filename) > 2 + && SREF (filename, 0) == '/' + && SREF (filename, 1) == ':') { - strncpy (fn, XSTRING (filename)->data + 2, - STRING_BYTES (XSTRING (filename)) - 2); - fn[STRING_BYTES (XSTRING (filename)) - 2] = 0; + strncpy (fn, SDATA (filename) + 2, + SBYTES (filename) - 2); + fn[SBYTES (filename) - 2] = 0; } else { - strncpy (fn, XSTRING (filename)->data, - STRING_BYTES (XSTRING (filename))); - fn[STRING_BYTES (XSTRING (filename))] = 0; + strncpy (fn, SDATA (filename), + SBYTES (filename)); + fn[SBYTES (filename)] = 0; } if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */ - strncat (fn, XSTRING (XCAR (tail))->data, lsuffix); + strncat (fn, SDATA (XCAR (tail)), lsuffix); /* Check that the file exists and is not a directory. */ /* We used to only check for handlers on non-absolute file names: @@ -1125,7 +1125,7 @@ openp (path, str, suffixes, storeptr, predicate) char *pfn; encoded_fn = ENCODE_FILE (string); - pfn = XSTRING (encoded_fn)->data; + pfn = SDATA (encoded_fn); exists = (stat (pfn, &st) >= 0 && (st.st_mode & S_IFMT) != S_IFDIR); if (exists) @@ -1507,12 +1507,12 @@ read_internal_start (stream, start, end) { int startval, endval; if (NILP (end)) - endval = XSTRING (stream)->size; + endval = SCHARS (stream); else { CHECK_NUMBER (end); endval = XINT (end); - if (endval < 0 || endval > XSTRING (stream)->size) + if (endval < 0 || endval > SCHARS (stream)) args_out_of_range (stream, end); } @@ -1963,17 +1963,17 @@ read1 (readcharfun, pch, first_in_list) UNREAD (c); tmp = read1 (readcharfun, pch, first_in_list); - if (size_in_chars != XSTRING (tmp)->size + if (size_in_chars != SCHARS (tmp) /* We used to print 1 char too many when the number of bits was a multiple of 8. Accept such input in case it came from an old version. */ && ! (XFASTINT (length) - == (XSTRING (tmp)->size - 1) * BITS_PER_CHAR)) + == (SCHARS (tmp) - 1) * BITS_PER_CHAR)) Fsignal (Qinvalid_read_syntax, Fcons (make_string ("#&...", 5), Qnil)); val = Fmake_bool_vector (length, Qnil); - bcopy (XSTRING (tmp)->data, XBOOL_VECTOR (val)->data, + bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, size_in_chars); /* Clear the extraneous bits in the last byte. */ if (XINT (length) != size_in_chars * BITS_PER_CHAR) @@ -2614,7 +2614,7 @@ substitute_object_recurse (object, placeholder, subtree) /* Check for text properties in each interval. substitute_in_interval contains part of the logic. */ - INTERVAL root_interval = XSTRING (subtree)->intervals; + INTERVAL root_interval = STRING_INTERVALS (subtree); Lisp_Object arg = Fcons (object, placeholder); traverse_intervals_noorder (root_interval, @@ -2760,8 +2760,8 @@ read_vector (readcharfun, bytecodeflag) /* Coerce string to unibyte (like string-as-unibyte, but without generating extra garbage and guaranteeing no change in the contents). */ - XSTRING (bytestr)->size = STRING_BYTES (XSTRING (bytestr)); - SET_STRING_BYTES (XSTRING (bytestr), -1); + SCHARS (bytestr) = SBYTES (bytestr); + STRING_SET_UNIBYTE (bytestr); item = Fread (bytestr); if (!CONSP (item)) @@ -3040,9 +3040,9 @@ it defaults to the value of `obarray'. */) CHECK_STRING (string); - tem = oblookup (obarray, XSTRING (string)->data, - XSTRING (string)->size, - STRING_BYTES (XSTRING (string))); + tem = oblookup (obarray, SDATA (string), + SCHARS (string), + SBYTES (string)); if (!INTEGERP (tem)) return tem; @@ -3055,7 +3055,7 @@ it defaults to the value of `obarray'. */) else XSYMBOL (sym)->interned = SYMBOL_INTERNED; - if ((XSTRING (string)->data[0] == ':') + if ((SREF (string, 0) == ':') && EQ (obarray, initial_obarray)) { XSYMBOL (sym)->constant = 1; @@ -3124,9 +3124,9 @@ OBARRAY defaults to the value of the variable `obarray'. */) string = name; } - tem = oblookup (obarray, XSTRING (string)->data, - XSTRING (string)->size, - STRING_BYTES (XSTRING (string))); + tem = oblookup (obarray, SDATA (string), + SCHARS (string), + SBYTES (string)); if (INTEGERP (tem)) return Qnil; /* If arg was a symbol, don't delete anything but that symbol itself. */ @@ -3203,9 +3203,9 @@ oblookup (obarray, ptr, size, size_byte) else for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next)) { - if (STRING_BYTES (XSTRING (SYMBOL_NAME (tail))) == size_byte - && XSTRING (SYMBOL_NAME (tail))->size == size - && !bcmp (XSTRING (SYMBOL_NAME (tail))->data, ptr, size_byte)) + if (SBYTES (SYMBOL_NAME (tail)) == size_byte + && SCHARS (SYMBOL_NAME (tail)) == size + && !bcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte)) return tail; else if (XSYMBOL (tail)->next == 0) break; @@ -3618,7 +3618,7 @@ init_lread () if (STRINGP (dirfile)) { dirfile = Fdirectory_file_name (dirfile); - if (access (XSTRING (dirfile)->data, 0) < 0) + if (access (SDATA (dirfile), 0) < 0) dir_warning ("Warning: Lisp directory `%s' does not exist.\n", XCAR (path_tail)); } @@ -3654,10 +3654,10 @@ dir_warning (format, dirname) Lisp_Object dirname; { char *buffer - = (char *) alloca (XSTRING (dirname)->size + strlen (format) + 5); + = (char *) alloca (SCHARS (dirname) + strlen (format) + 5); - fprintf (stderr, format, XSTRING (dirname)->data); - sprintf (buffer, format, XSTRING (dirname)->data); + fprintf (stderr, format, SDATA (dirname)); + sprintf (buffer, format, SDATA (dirname)); /* Don't log the warning before we've initialized!! */ if (initialized) message_dolog (buffer, strlen (buffer), 0, STRING_MULTIBYTE (dirname)); diff --git a/src/mac.c b/src/mac.c index 4a97b0d7dd9..f3d65604f5b 100644 --- a/src/mac.c +++ b/src/mac.c @@ -2048,7 +2048,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) if (NILP (path)) return -1; - if (posix_to_mac_pathname (XSTRING (path)->data, tempmacpathname, + if (posix_to_mac_pathname (SDATA (path), tempmacpathname, MAXPATHLEN+1) == 0) return -1; } @@ -2529,7 +2529,7 @@ component. */) CHECK_STRING (script); - status = do_applescript (XSTRING (script)->data, &result); + status = do_applescript (SDATA (script), &result); if (status) { if (!result) @@ -2566,7 +2566,7 @@ DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix, CHECK_STRING (mac_filename); - if (mac_to_posix_pathname (XSTRING (mac_filename)->data, posix_filename, + if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename, MAXPATHLEN)) return build_string (posix_filename); else @@ -2584,7 +2584,7 @@ DEFUN ("posix-file-name-to-mac", Fposix_file_name_to_mac, CHECK_STRING (posix_filename); - if (posix_to_mac_pathname (XSTRING (posix_filename)->data, mac_filename, + if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename, MAXPATHLEN)) return build_string (mac_filename); else @@ -2670,9 +2670,9 @@ DEFUN ("mac-cut-function", Fmac_cut_function, Smac_cut_function, 1, 2, 0, CHECK_STRING (value); - len = XSTRING (value)->size; + len = SCHARS (value); buf = (char *) alloca (len+1); - bcopy (XSTRING (value)->data, buf, len); + bcopy (SDATA (value), buf, len); buf[len] = '\0'; /* convert to Mac-style eol's before sending to clipboard */ diff --git a/src/macfns.c b/src/macfns.c index 9a9baed37a5..04cedba11dc 100644 --- a/src/macfns.c +++ b/src/macfns.c @@ -534,7 +534,7 @@ x_create_bitmap_from_file (f, file) { if (dpyinfo->bitmaps[id].refcount && dpyinfo->bitmaps[id].file - && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) + && !strcmp (dpyinfo->bitmaps[id].file, (char *) SDATA (file))) { ++dpyinfo->bitmaps[id].refcount; return id + 1; @@ -550,7 +550,7 @@ x_create_bitmap_from_file (f, file) return -1; emacs_close (fd); - filename = (char *) XSTRING (found)->data; + filename = (char *) SDATA (found); hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE); @@ -566,11 +566,11 @@ x_create_bitmap_from_file (f, file) id = x_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].pixmap = bitmap; dpyinfo->bitmaps[id - 1].refcount = 1; - dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1); + dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SCHARS (file) + 1); dpyinfo->bitmaps[id - 1].depth = 1; dpyinfo->bitmaps[id - 1].height = height; dpyinfo->bitmaps[id - 1].width = width; - strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); + strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file)); return id; #endif /* MAC_TODO */ @@ -2067,9 +2067,9 @@ x_decode_color (f, arg, def) CHECK_STRING (arg); - if (strcmp (XSTRING (arg)->data, "black") == 0) + if (strcmp (SDATA (arg), "black") == 0) return BLACK_PIX_DEFAULT (f); - else if (strcmp (XSTRING (arg)->data, "white") == 0) + else if (strcmp (SDATA (arg), "white") == 0) return WHITE_PIX_DEFAULT (f); #if 0 @@ -2078,7 +2078,7 @@ x_decode_color (f, arg, def) return def; #endif - if (mac_defined_color (f, XSTRING (arg)->data, &cdef, 1)) + if (mac_defined_color (f, SDATA (arg), &cdef, 1)) return cdef.pixel; /* defined_color failed; return an ultimate default. */ @@ -2509,11 +2509,11 @@ x_set_icon_name (f, arg, oldval) BLOCK_INPUT; result = x_text_icon (f, - (char *) XSTRING ((!NILP (f->icon_name) - ? f->icon_name - : !NILP (f->title) - ? f->title - : f->name))->data); + (char *) SDATA ((!NILP (f->icon_name) + ? f->icon_name + : !NILP (f->title) + ? f->title + : f->name))); if (result) { @@ -2555,12 +2555,12 @@ x_set_font (f, arg, oldval) BLOCK_INPUT; result = (STRINGP (fontset_name) - ? x_new_fontset (f, XSTRING (fontset_name)->data) - : x_new_font (f, XSTRING (arg)->data)); + ? x_new_fontset (f, SDATA (fontset_name)) + : x_new_font (f, SDATA (arg))); UNBLOCK_INPUT; if (EQ (result, Qnil)) - error ("Font `%s' is not defined", XSTRING (arg)->data); + error ("Font `%s' is not defined", SDATA (arg)); else if (EQ (result, Qt)) error ("The characters of the given font have varying widths"); else if (STRINGP (result)) @@ -2836,7 +2836,7 @@ x_set_name (f, name, explicit) /* Check for no change needed in this very common case before we do any consing. */ if (!strcmp (FRAME_MAC_DISPLAY_INFO (f)->mac_id_name, - XSTRING (f->name)->data)) + SDATA (f->name))) return; name = build_string (FRAME_MAC_DISPLAY_INFO (f)->mac_id_name); } @@ -2867,9 +2867,9 @@ x_set_name (f, name, explicit) { Str255 windowTitle; - if (strlen (XSTRING (name)->data) < 255) + if (strlen (SDATA (name)) < 255) { - strcpy (windowTitle, XSTRING (name)->data); + strcpy (windowTitle, SDATA (name)); c2pstr (windowTitle); SetWTitle (FRAME_MAC_WINDOW (f), windowTitle); } @@ -2941,9 +2941,9 @@ x_set_title (f, name, old_name) { Str255 windowTitle; - if (strlen (XSTRING (name)->data) < 255) + if (strlen (SDATA (name)) < 255) { - strcpy (windowTitle, XSTRING (name)->data); + strcpy (windowTitle, SDATA (name)); c2pstr (windowTitle); SetWTitle (FRAME_MAC_WINDOW (f), windowTitle); } @@ -3067,10 +3067,10 @@ validate_x_resource_name () if (STRINGP (Vx_resource_name)) { - unsigned char *p = XSTRING (Vx_resource_name)->data; + unsigned char *p = SDATA (Vx_resource_name); int i; - len = STRING_BYTES (XSTRING (Vx_resource_name)); + len = SBYTES (Vx_resource_name); /* Only letters, digits, - and _ are valid in resource names. Count the valid characters and count the invalid ones. */ @@ -3109,12 +3109,12 @@ validate_x_resource_name () for (i = 0; i < len; i++) { - int c = XSTRING (new)->data[i]; + int c = SREF (new, i); if (! ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '_')) - XSTRING (new)->data[i] = '_'; + SREF (new, i) = '_'; } } @@ -3153,37 +3153,37 @@ and the class is `Emacs.CLASS.SUBCLASS'. */) /* Allocate space for the components, the dots which separate them, and the final '\0'. Make them big enough for the worst case. */ - name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name)) + name_key = (char *) alloca (SBYTES (Vx_resource_name) + (STRINGP (component) - ? STRING_BYTES (XSTRING (component)) : 0) - + STRING_BYTES (XSTRING (attribute)) + ? SBYTES (component) : 0) + + SBYTES (attribute) + 3); class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) - + STRING_BYTES (XSTRING (class)) + + SBYTES (class) + (STRINGP (subclass) - ? STRING_BYTES (XSTRING (subclass)) : 0) + ? SBYTES (subclass) : 0) + 3); /* Start with emacs.FRAMENAME for the name (the specific one) and with `Emacs' for the class key (the general one). */ - strcpy (name_key, XSTRING (Vx_resource_name)->data); + strcpy (name_key, SDATA (Vx_resource_name)); strcpy (class_key, EMACS_CLASS); strcat (class_key, "."); - strcat (class_key, XSTRING (class)->data); + strcat (class_key, SDATA (class)); if (!NILP (component)) { strcat (class_key, "."); - strcat (class_key, XSTRING (subclass)->data); + strcat (class_key, SDATA (subclass)); strcat (name_key, "."); - strcat (name_key, XSTRING (component)->data); + strcat (name_key, SDATA (component)); } strcat (name_key, "."); - strcat (name_key, XSTRING (attribute)->data); + strcat (name_key, SDATA (attribute)); value = x_get_string_resource (Qnil, name_key, class_key); @@ -3206,13 +3206,13 @@ x_get_resource_string (attribute, class) /* Allocate space for the components, the dots which separate them, and the final '\0'. */ - name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name)) + name_key = (char *) alloca (SBYTES (Vinvocation_name) + strlen (attribute) + 2); class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) + strlen (class) + 2); sprintf (name_key, "%s.%s", - XSTRING (Vinvocation_name)->data, + SDATA (Vinvocation_name), attribute); sprintf (class_key, "%s.%s", EMACS_CLASS, class); @@ -3269,15 +3269,15 @@ mac_get_arg (alist, param, attribute, class, type) switch (type) { case RES_TYPE_NUMBER: - return make_number (atoi (XSTRING (tem)->data)); + return make_number (atoi (SDATA (tem))); case RES_TYPE_FLOAT: - return make_float (atof (XSTRING (tem)->data)); + return make_float (atof (SDATA (tem))); case RES_TYPE_BOOLEAN: tem = Fdowncase (tem); - if (!strcmp (XSTRING (tem)->data, "on") - || !strcmp (XSTRING (tem)->data, "true")) + if (!strcmp (SDATA (tem), "on") + || !strcmp (SDATA (tem), "true")) return Qt; else return Qnil; @@ -3291,11 +3291,11 @@ mac_get_arg (alist, param, attribute, class, type) { Lisp_Object lower; lower = Fdowncase (tem); - if (!strcmp (XSTRING (lower)->data, "on") - || !strcmp (XSTRING (lower)->data, "true")) + if (!strcmp (SDATA (lower), "on") + || !strcmp (SDATA (lower), "true")) return Qt; - else if (!strcmp (XSTRING (lower)->data, "off") - || !strcmp (XSTRING (lower)->data, "false")) + else if (!strcmp (SDATA (lower), "off") + || !strcmp (SDATA (lower), "false")) return Qnil; else return Fintern (tem, Qnil); @@ -3490,7 +3490,7 @@ or a list (- N) meaning -N pixels relative to bottom/right corner. */) CHECK_STRING (string); - geometry = XParseGeometry ((char *) XSTRING (string)->data, + geometry = XParseGeometry ((char *) SDATA (string), &x, &y, &width, &height); result = Qnil; @@ -3678,7 +3678,7 @@ mac_window (f, window_prompting, minibuffer_only) Elsewhere we specify the window name for the window manager. */ { - char *str = (char *) XSTRING (Vx_resource_name)->data; + char *str = (char *) SDATA (Vx_resource_name); f->namebuf = (char *) xmalloc (strlen (str) + 1); strcpy (f->namebuf, str); } @@ -3752,9 +3752,9 @@ x_icon (f, parms) ? IconicState : NormalState)); - x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name) + x_text_icon (f, (char *) SDATA ((!NILP (f->icon_name) ? f->icon_name - : f->name))->data); + : f->name))); #endif UNBLOCK_INPUT; @@ -3964,9 +3964,9 @@ This function is an internal primitive--use `make-frame' instead. */) { tem = Fquery_fontset (font, Qnil); if (STRINGP (tem)) - font = x_new_fontset (f, XSTRING (tem)->data); + font = x_new_fontset (f, SDATA (tem)); else - font = x_new_font (f, XSTRING (font)->data); + font = x_new_font (f, SDATA (font)); } /* Try out a font which we hope has bold and italic variations. */ if (! STRINGP (font)) @@ -4178,7 +4178,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, CHECK_STRING (color); - if (mac_defined_color (f, XSTRING (color)->data, &foo, 0)) + if (mac_defined_color (f, SDATA (color), &foo, 0)) return Qt; else return Qnil; @@ -4194,7 +4194,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, CHECK_STRING (color); - if (mac_defined_color (f, XSTRING (color)->data, &foo, 0)) + if (mac_defined_color (f, SDATA (color), &foo, 0)) { Lisp_Object rgb[3]; @@ -4515,10 +4515,10 @@ x_display_info_for_name (name) validate_x_resource_name (); dpyinfo = mac_term_init (name, (unsigned char *) 0, - (char *) XSTRING (Vx_resource_name)->data); + (char *) SDATA (Vx_resource_name)); if (dpyinfo == 0) - error ("Cannot connect to server %s", XSTRING (name)->data); + error ("Cannot connect to server %s", SDATA (name)); mac_in_use = 1; XSETFASTINT (Vwindow_system_version, 3); @@ -4548,7 +4548,7 @@ terminate Emacs if we can't open the connection. */) error ("Not using Mac OS"); if (! NILP (xrm_string)) - xrm_option = (unsigned char *) XSTRING (xrm_string)->data; + xrm_option = (unsigned char *) SDATA (xrm_string); else xrm_option = (unsigned char *) 0; @@ -4557,15 +4557,15 @@ terminate Emacs if we can't open the connection. */) /* This is what opens the connection and sets x_current_display. This also initializes many symbols, such as those used for input. */ dpyinfo = mac_term_init (display, xrm_option, - (char *) XSTRING (Vx_resource_name)->data); + (char *) SDATA (Vx_resource_name)); if (dpyinfo == 0) { if (!NILP (must_succeed)) fatal ("Cannot connect to server %s.\n", - XSTRING (display)->data); + SDATA (display)); else - error ("Cannot connect to server %s", XSTRING (display)->data); + error ("Cannot connect to server %s", SDATA (display)); } mac_in_use = 1; @@ -4842,7 +4842,7 @@ parse_image_spec (spec, keywords, nkeywords, type) /* Find key in KEYWORDS. Error if not found. */ for (i = 0; i < nkeywords; ++i) - if (strcmp (keywords[i].name, XSTRING (SYMBOL_NAME (key))->data) == 0) + if (strcmp (keywords[i].name, SDATA (SYMBOL_NAME (key))) == 0) break; if (i == nkeywords) @@ -5152,7 +5152,7 @@ x_alloc_image_color (f, img, color_name, dflt) xassert (STRINGP (color_name)); - if (w32_defined_color (f, XSTRING (color_name)->data, &color, 1)) + if (w32_defined_color (f, SDATA (color_name), &color, 1)) { /* This isn't called frequently so we get away with simply reallocating the color vector to the needed size, here. */ @@ -5730,7 +5730,7 @@ xbm_image_p (object) if (STRINGP (elt)) { - if (XSTRING (elt)->size + if (SCHARS (elt) < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR) return 0; } @@ -5745,7 +5745,7 @@ xbm_image_p (object) } else if (STRINGP (data)) { - if (XSTRING (data)->size + if (SCHARS (data) < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height) return 0; } @@ -6026,7 +6026,7 @@ xbm_load_image_from_file (f, img, specified_file) return 0; } - rc = xbm_read_bitmap_file_data (XSTRING (file)->data, &img->width, + rc = xbm_read_bitmap_file_data (SDATA (file), &img->width, &img->height, &data); if (rc) { @@ -6139,13 +6139,13 @@ xbm_load (f, img) { Lisp_Object line = XVECTOR (data)->contents[i]; if (STRINGP (line)) - bcopy (XSTRING (line)->data, p, nbytes); + bcopy (SDATA (line), p, nbytes); else bcopy (XBOOL_VECTOR (line)->data, p, nbytes); } } else if (STRINGP (data)) - bits = XSTRING (data)->data; + bits = SDATA (data); else bits = XBOOL_VECTOR (data)->data; @@ -6337,10 +6337,10 @@ xpm_load (f, img) { Lisp_Object name = XCAR (XCAR (tail)); Lisp_Object color = XCDR (XCAR (tail)); - xpm_syms[i].name = (char *) alloca (XSTRING (name)->size + 1); - strcpy (xpm_syms[i].name, XSTRING (name)->data); - xpm_syms[i].value = (char *) alloca (XSTRING (color)->size + 1); - strcpy (xpm_syms[i].value, XSTRING (color)->data); + xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1); + strcpy (xpm_syms[i].name, SDATA (name)); + xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); + strcpy (xpm_syms[i].value, SDATA (color)); } } @@ -6359,14 +6359,14 @@ xpm_load (f, img) } rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f), - XSTRING (file)->data, &img->pixmap, &img->mask, + SDATA (file), &img->pixmap, &img->mask, &attrs); } else { Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL); rc = XpmCreatePixmapFromBuffer (NULL, FRAME_W32_WINDOW (f), - XSTRING (buffer)->data, + SDATA (buffer), &img->pixmap, &img->mask, &attrs); } @@ -6998,8 +6998,8 @@ pbm_read_file (file, size) char *buf = NULL; struct stat st; - if (stat (XSTRING (file)->data, &st) == 0 - && (fp = fopen (XSTRING (file)->data, "r")) != NULL + if (stat (SDATA (file), &st) == 0 + && (fp = fopen (SDATA (file), "r")) != NULL && (buf = (char *) xmalloc (st.st_size), fread (buf, 1, st.st_size, fp) == st.st_size)) { @@ -7067,8 +7067,8 @@ pbm_load (f, img) { Lisp_Object data; data = image_spec_value (img->spec, QCdata, NULL); - p = XSTRING (data)->data; - end = p + STRING_BYTES (XSTRING (data)); + p = SDATA (data); + end = p + SBYTES (data); } /* Check magic number. */ @@ -7401,7 +7401,7 @@ png_load (f, img) } /* Open the image file. */ - fp = fopen (XSTRING (file)->data, "rb"); + fp = fopen (SDATA (file), "rb"); if (!fp) { image_error ("Cannot open image file `%s'", file, Qnil); @@ -7423,8 +7423,8 @@ png_load (f, img) else { /* Read from memory. */ - tbr.bytes = XSTRING (specified_data)->data; - tbr.len = STRING_BYTES (XSTRING (specified_data)); + tbr.bytes = SDATA (specified_data); + tbr.len = SBYTES (specified_data); tbr.index = 0; /* Check PNG signature. */ @@ -7936,7 +7936,7 @@ jpeg_load (f, img) return 0; } - fp = fopen (XSTRING (file)->data, "r"); + fp = fopen (SDATA (file), "r"); if (fp == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -7986,8 +7986,8 @@ jpeg_load (f, img) if (NILP (specified_data)) jpeg_stdio_src (&cinfo, fp); else - jpeg_memory_src (&cinfo, XSTRING (specified_data)->data, - STRING_BYTES (XSTRING (specified_data))); + jpeg_memory_src (&cinfo, SDATA (specified_data), + SBYTES (specified_data)); jpeg_read_header (&cinfo, TRUE); @@ -8295,7 +8295,7 @@ tiff_load (f, img) } /* Try to open the image file. */ - tiff = TIFFOpen (XSTRING (file)->data, "r"); + tiff = TIFFOpen (SDATA (file), "r"); if (tiff == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -8306,8 +8306,8 @@ tiff_load (f, img) else { /* Memory source! */ - memsrc.bytes = XSTRING (specified_data)->data; - memsrc.len = STRING_BYTES (XSTRING (specified_data)); + memsrc.bytes = SDATA (specified_data); + memsrc.len = SBYTES (specified_data); memsrc.index = 0; tiff = TIFFClientOpen ("memory_source", "r", &memsrc, @@ -8539,7 +8539,7 @@ gif_load (f, img) } /* Open the GIF file. */ - gif = DGifOpenFileName (XSTRING (file)->data); + gif = DGifOpenFileName (SDATA (file)); if (gif == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -8551,8 +8551,8 @@ gif_load (f, img) { /* Read from memory! */ current_gif_memory_src = &memsrc; - memsrc.bytes = XSTRING (specified_data)->data; - memsrc.len = STRING_BYTES (XSTRING (specified_data)); + memsrc.bytes = SDATA (specified_data); + memsrc.len = SBYTES (specified_data); memsrc.index = 0; gif = DGifOpen(&memsrc, gif_read_from_memory); @@ -8999,10 +8999,10 @@ selected frame. Value is VALUE. */) CHECK_STRING (value); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom, XA_STRING, 8, PropModeReplace, - XSTRING (value)->data, XSTRING (value)->size); + SDATA (value), SCHARS (value)); /* Make sure the property is set when we return. */ XFlush (FRAME_W32_DISPLAY (f)); @@ -9028,7 +9028,7 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) CHECK_STRING (prop); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom); /* Make sure the property is removed when we return. */ @@ -9062,7 +9062,7 @@ value. */) CHECK_STRING (prop); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom, 0, 0, False, XA_STRING, &actual_type, &actual_format, &actual_size, @@ -9378,9 +9378,9 @@ x_create_tip_frame (dpyinfo, parms) { tem = Fquery_fontset (font, Qnil); if (STRINGP (tem)) - font = x_new_fontset (f, XSTRING (tem)->data); + font = x_new_fontset (f, SDATA (tem)); else - font = x_new_font (f, XSTRING (font)->data); + font = x_new_font (f, SDATA (font)); } /* Try out a font which we hope has bold and italic variations. */ @@ -9800,14 +9800,14 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */) /* Create the dialog with PROMPT as title, using DIR as initial directory and using "*" as pattern. */ dir = Fexpand_file_name (dir, Qnil); - strncpy (init_dir, XSTRING (dir)->data, MAX_PATH); + strncpy (init_dir, SDATA (dir), MAX_PATH); init_dir[MAX_PATH] = '\0'; unixtodos_filename (init_dir); if (STRINGP (default_filename)) { char *file_name_only; - char *full_path_name = XSTRING (default_filename)->data; + char *full_path_name = SDATA (default_filename); unixtodos_filename (full_path_name); @@ -9846,7 +9846,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */) file_details.lpstrFile = filename; file_details.nMaxFile = sizeof (filename); file_details.lpstrInitialDir = init_dir; - file_details.lpstrTitle = XSTRING (prompt)->data; + file_details.lpstrTitle = SDATA (prompt); file_details.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR; if (!NILP (mustmatch)) diff --git a/src/macmenu.c b/src/macmenu.c index 15190a7813b..cb51018ce00 100644 --- a/src/macmenu.c +++ b/src/macmenu.c @@ -541,7 +541,7 @@ single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth) enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; - if (!NILP (map) && XSTRING (item_string)->data[0] == '@') + if (!NILP (map) && SREF (item_string, 0) == '@') { if (!NILP (enabled)) /* An enabled separate pane. Remember this to handle it later. */ @@ -1223,7 +1223,7 @@ single_submenu (item_key, item_name, maps) } #endif pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); /* If there is just one top-level pane, put all its items directly under the top-level menu. */ if (menu_items_n_panes == 1) @@ -1287,9 +1287,9 @@ single_submenu (item_key, item_name, maps) else save_wv->contents = wv; - wv->name = (char *) XSTRING (item_name)->data; + wv->name = (char *) SDATA (item_name); if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; + wv->key = (char *) SDATA (descrip); wv->value = 0; /* The EMACS_INT cast avoids a warning. There's no problem as long as pointers have enough bits to hold small integers. */ @@ -1470,7 +1470,7 @@ set_frame_menubar (f, first_time, deep_p) string = XVECTOR (items)->contents[i + 1]; if (NILP (string)) break; - wv->name = (char *) XSTRING (string)->data; + wv->name = (char *) SDATA (string); wv = wv->next; } @@ -1493,7 +1493,7 @@ set_frame_menubar (f, first_time, deep_p) break; wv = xmalloc_widget_value (); - wv->name = (char *) XSTRING (string)->data; + wv->name = (char *) SDATA (string); wv->value = 0; wv->enabled = 1; wv->button_type = BUTTON_TYPE_NONE; @@ -1676,7 +1676,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) } #endif pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); /* If there is just one top-level pane, put all its items directly under the top-level menu. */ if (menu_items_n_panes == 1) @@ -1741,9 +1741,9 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) prev_wv->next = wv; else save_wv->contents = wv; - wv->name = (char *) XSTRING (item_name)->data; + wv->name = (char *) SDATA (item_name); if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; + wv->key = (char *) SDATA (descrip); wv->value = 0; /* Use the contents index as call_data, since we are restricted to 16-bits. */ @@ -1787,7 +1787,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) if (STRING_MULTIBYTE (title)) title = ENCODE_SYSTEM (title); #endif - wv_title->name = (char *) XSTRING (title)->data; + wv_title->name = (char *) SDATA (title); wv_title->enabled = TRUE; wv_title->title = TRUE; wv_title->button_type = BUTTON_TYPE_NONE; @@ -2047,7 +2047,7 @@ mac_dialog_show (f, keymaps, title, error) pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); prev_wv = xmalloc_widget_value (); prev_wv->value = pane_string; if (keymaps && !NILP (prefix)) @@ -2096,8 +2096,8 @@ mac_dialog_show (f, keymaps, title, error) prev_wv->next = wv; wv->name = (char *) button_names[nb_buttons]; if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; - wv->value = (char *) XSTRING (item_name)->data; + wv->key = (char *) SDATA (descrip); + wv->value = (char *) SDATA (item_name); wv->call_data = (void *) i; /* menu item is identified by its index in menu_items table */ wv->enabled = !NILP (enable); diff --git a/src/macterm.c b/src/macterm.c index 7885f6c4a30..c471ba4bf35 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -7005,9 +7005,9 @@ note_mode_line_highlight (w, x, mode_line_p) if (glyph < end && STRINGP (glyph->object) - && XSTRING (glyph->object)->intervals + && STRING_INTERVALS (glyph->object) && glyph->charpos >= 0 - && glyph->charpos < XSTRING (glyph->object)->size) + && glyph->charpos < SCHARS (glyph->object)) { /* If we're on a string with `help-echo' text property, arrange for the help to be displayed. This is done by @@ -7328,7 +7328,7 @@ note_mouse_highlight (f, x, y) if (NILP (b)) b = make_number (0); if (NILP (e)) - e = make_number (XSTRING (object)->size - 1); + e = make_number (SCHARS (object) - 1); fast_find_string_pos (w, XINT (b), object, &dpyinfo->mouse_face_beg_col, &dpyinfo->mouse_face_beg_row, @@ -7426,7 +7426,7 @@ note_mouse_highlight (f, x, y) /* Try text properties. */ if (STRINGP (object) && charpos >= 0 - && charpos < XSTRING (object)->size) + && charpos < SCHARS (object)) { help = Fget_text_property (make_number (charpos), Qhelp_echo, object); @@ -9469,7 +9469,7 @@ x_bitmap_icon (f, icon) if (NILP (icon)) hicon = LoadIcon (hinst, EMACS_CLASS); else if (STRINGP (icon)) - hicon = LoadImage (NULL, (LPCTSTR) XSTRING (icon)->data, IMAGE_ICON, 0, 0, + hicon = LoadImage (NULL, (LPCTSTR) SDATA (icon), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE); else if (SYMBOLP (icon)) { @@ -9606,7 +9606,7 @@ x_new_fontset (f, fontsetname) to do. */ return fontset_name (fontset); - result = x_new_font (f, (XSTRING (fontset_ascii (fontset))->data)); + result = x_new_font (f, (SDATA (fontset_ascii (fontset)))); if (!STRINGP (result)) /* Can't load ASCII font. */ @@ -10893,7 +10893,7 @@ x_list_fonts (struct frame *f, } } - ptnstr = XSTRING (pattern)->data; + ptnstr = SDATA (pattern); GCPRO2 (pattern, newlist); @@ -11243,9 +11243,9 @@ x_load_font (f, fontname, size) for (tail = font_names; CONSP (tail); tail = XCDR (tail)) if (dpyinfo->font_table[i].name && (!strcmp (dpyinfo->font_table[i].name, - XSTRING (XCAR (tail))->data) + SDATA (XCAR (tail))) || !strcmp (dpyinfo->font_table[i].full_name, - XSTRING (XCAR (tail))->data))) + SDATA (XCAR (tail))))) return (dpyinfo->font_table + i); } @@ -11263,7 +11263,7 @@ x_load_font (f, fontname, size) a bug of not finding a font even if the font surely exists and is loadable by XLoadQueryFont. */ if (size > 0 && !NILP (font_names)) - fontname = (char *) XSTRING (XCAR (font_names))->data; + fontname = (char *) SDATA (XCAR (font_names)); font = (MacFontStruct *) XLoadQueryFont (FRAME_MAC_DISPLAY (f), fontname); if (!font) @@ -11457,7 +11457,7 @@ same_x_server (name1, name2) char *name1, *name2; { int seen_colon = 0; - unsigned char *system_name = XSTRING (Vsystem_name)->data; + unsigned char *system_name = SDATA (Vsystem_name); int system_name_length = strlen (system_name); int length_until_period = 0; @@ -12968,7 +12968,7 @@ same_x_server (name1, name2) char *name1, *name2; { int seen_colon = 0; - unsigned char *system_name = XSTRING (Vsystem_name)->data; + unsigned char *system_name = SDATA (Vsystem_name); int system_name_length = strlen (system_name); int length_until_period = 0; @@ -13026,11 +13026,11 @@ mac_initialize_display_info () #if 0 dpyinfo->mac_id_name - = (char *) xmalloc (XSTRING (Vinvocation_name)->size - + XSTRING (Vsystem_name)->size + = (char *) xmalloc (SCHARS (Vinvocation_name) + + SCHARS (Vsystem_name) + 2); sprintf (dpyinfo->mac_id_name, "%s@%s", - XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data); + SDATA (Vinvocation_name), SDATA (Vsystem_name)); #else dpyinfo->mac_id_name = (char *) xmalloc (strlen ("Mac Display") + 1); strcpy (dpyinfo->mac_id_name, "Mac Display"); diff --git a/src/minibuf.c b/src/minibuf.c index 00380392efe..87cdcea4522 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -233,21 +233,21 @@ string_to_object (val, defalt) GCPRO2 (val, defalt); - if (STRINGP (val) && XSTRING (val)->size == 0 + if (STRINGP (val) && SCHARS (val) == 0 && STRINGP (defalt)) val = defalt; expr_and_pos = Fread_from_string (val, Qnil, Qnil); pos = XINT (Fcdr (expr_and_pos)); - if (pos != XSTRING (val)->size) + if (pos != SCHARS (val)) { /* Ignore trailing whitespace; any other trailing junk is an error. */ int i; pos = string_char_to_byte (val, pos); - for (i = pos; i < STRING_BYTES (XSTRING (val)); i++) + for (i = pos; i < SBYTES (val); i++) { - int c = XSTRING (val)->data[i]; + int c = SREF (val, i); if (c != ' ' && c != '\t' && c != '\n') error ("Trailing garbage following expression"); } @@ -280,7 +280,7 @@ read_minibuf_noninteractive (map, initial, prompt, backup_n, expflag, char *line, *s; Lisp_Object val; - fprintf (stdout, "%s", XSTRING (prompt)->data); + fprintf (stdout, "%s", SDATA (prompt)); fflush (stdout); val = Qnil; @@ -648,7 +648,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, last_minibuf_string = val; /* Add the value to the appropriate history list unless it is empty. */ - if (XSTRING (val)->size != 0 + if (SCHARS (val) != 0 && SYMBOLP (Vminibuffer_history_variable)) { /* If the caller wanted to save the value read on a history list, @@ -868,9 +868,9 @@ If the variable `minibuffer-allow-text-properties' is non-nil, /* Convert to distance from end of input. */ if (XINT (position) < 1) /* A number too small means the beginning of the string. */ - pos = - XSTRING (initial_contents)->size; + pos = - SCHARS (initial_contents); else - pos = XINT (position) - 1 - XSTRING (initial_contents)->size; + pos = XINT (position) - 1 - SCHARS (initial_contents); } } @@ -950,7 +950,7 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits val = Fread_from_minibuffer (prompt, initial_input, Qnil, Qnil, history, default_value, inherit_input_method); - if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (default_value)) + if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value)) val = default_value; return val; } @@ -1185,9 +1185,9 @@ is used to further constrain the set of candidates. */) /* Is this element a possible completion? */ if (STRINGP (eltstring) - && XSTRING (string)->size <= XSTRING (eltstring)->size + && SCHARS (string) <= SCHARS (eltstring) && (tem = Fcompare_strings (eltstring, make_number (0), - make_number (XSTRING (string)->size), + make_number (SCHARS (string)), string, make_number (0), Qnil, completion_ignore_case ?Qt : Qnil), EQ (Qt, tem))) @@ -1233,11 +1233,11 @@ is used to further constrain the set of candidates. */) { matchcount = 1; bestmatch = eltstring; - bestmatchsize = XSTRING (eltstring)->size; + bestmatchsize = SCHARS (eltstring); } else { - compare = min (bestmatchsize, XSTRING (eltstring)->size); + compare = min (bestmatchsize, SCHARS (eltstring)); tem = Fcompare_strings (bestmatch, make_number (0), make_number (compare), eltstring, make_number (0), @@ -1259,8 +1259,8 @@ is used to further constrain the set of candidates. */) use it as the best match rather than one that is not an exact match. This way, we get the case pattern of the actual match. */ - if ((matchsize == XSTRING (eltstring)->size - && matchsize < XSTRING (bestmatch)->size) + if ((matchsize == SCHARS (eltstring) + && matchsize < SCHARS (bestmatch)) || /* If there is more than one exact match ignoring case, and one of them is exact including case, @@ -1268,29 +1268,29 @@ is used to further constrain the set of candidates. */) /* If there is no exact match ignoring case, prefer a match that does not change the case of the input. */ - ((matchsize == XSTRING (eltstring)->size) + ((matchsize == SCHARS (eltstring)) == - (matchsize == XSTRING (bestmatch)->size) + (matchsize == SCHARS (bestmatch)) && (tem = Fcompare_strings (eltstring, make_number (0), - make_number (XSTRING (string)->size), + make_number (SCHARS (string)), string, make_number (0), Qnil, Qnil), EQ (Qt, tem)) && (tem = Fcompare_strings (bestmatch, make_number (0), - make_number (XSTRING (string)->size), + make_number (SCHARS (string)), string, make_number (0), Qnil, Qnil), ! EQ (Qt, tem)))) bestmatch = eltstring; } - if (bestmatchsize != XSTRING (eltstring)->size + if (bestmatchsize != SCHARS (eltstring) || bestmatchsize != matchsize) /* Don't count the same string multiple times. */ matchcount++; bestmatchsize = matchsize; - if (matchsize <= XSTRING (string)->size + if (matchsize <= SCHARS (string) && matchcount > 1) /* No need to look any further. */ break; @@ -1303,13 +1303,13 @@ is used to further constrain the set of candidates. */) /* If we are ignoring case, and there is no exact match, and no additional text was supplied, don't change the case of what the user typed. */ - if (completion_ignore_case && bestmatchsize == XSTRING (string)->size - && XSTRING (bestmatch)->size > bestmatchsize) + if (completion_ignore_case && bestmatchsize == SCHARS (string) + && SCHARS (bestmatch) > bestmatchsize) return minibuf_conform_representation (string, bestmatch); /* Return t if the supplied string is an exact match (counting case); it does not require any change to be made. */ - if (matchcount == 1 && bestmatchsize == XSTRING (string)->size + if (matchcount == 1 && bestmatchsize == SCHARS (string) && (tem = Fcompare_strings (bestmatch, make_number (0), make_number (bestmatchsize), string, make_number (0), @@ -1423,17 +1423,17 @@ are ignored unless STRING itself starts with a space. */) /* Is this element a possible completion? */ if (STRINGP (eltstring) - && XSTRING (string)->size <= XSTRING (eltstring)->size + && SCHARS (string) <= SCHARS (eltstring) /* If HIDE_SPACES, reject alternatives that start with space unless the input starts with space. */ - && ((STRING_BYTES (XSTRING (string)) > 0 - && XSTRING (string)->data[0] == ' ') - || XSTRING (eltstring)->data[0] != ' ' + && ((SBYTES (string) > 0 + && SREF (string, 0) == ' ') + || SREF (eltstring, 0) != ' ' || NILP (hide_spaces)) && (tem = Fcompare_strings (eltstring, make_number (0), - make_number (XSTRING (string)->size), + make_number (SCHARS (string)), string, make_number (0), - make_number (XSTRING (string)->size), + make_number (SCHARS (string)), completion_ignore_case ? Qt : Qnil), EQ (Qt, tem))) { @@ -1553,7 +1553,7 @@ Completion ignores case if the ambient value of { CHECK_NUMBER (position); /* Convert to distance from end of input. */ - pos = XINT (position) - XSTRING (init)->size; + pos = XINT (position) - SCHARS (init); } } @@ -1579,7 +1579,7 @@ Completion ignores case if the ambient value of histvar, histpos, def, 0, !NILP (inherit_input_method)); - if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (def)) + if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) val = def; RETURN_UNGCPRO (unbind_to (count, val)); @@ -1613,9 +1613,9 @@ the values STRING, PREDICATE and `lambda'. */) { /* Bypass intern-soft as that loses for nil. */ tem = oblookup (alist, - XSTRING (string)->data, - XSTRING (string)->size, - STRING_BYTES (XSTRING (string))); + SDATA (string), + SCHARS (string), + SBYTES (string)); if (!SYMBOLP (tem)) { if (STRING_MULTIBYTE (string)) @@ -1624,9 +1624,9 @@ the values STRING, PREDICATE and `lambda'. */) string = Fstring_make_multibyte (string); tem = oblookup (Vminibuffer_completion_table, - XSTRING (string)->data, - XSTRING (string)->size, - STRING_BYTES (XSTRING (string))); + SDATA (string), + SCHARS (string), + SBYTES (string)); if (!SYMBOLP (tem)) return Qnil; } @@ -1716,7 +1716,7 @@ do_completion () /* Some completion happened */ if (! NILP (Vminibuffer_completing_file_name) - && XSTRING (completion)->data[STRING_BYTES (XSTRING (completion)) - 1] == '/' + && SREF (completion, SBYTES (completion) - 1) == '/' && PT < ZV && FETCH_CHAR (PT_BYTE) == '/') { @@ -1963,9 +1963,9 @@ Return nil if there is no valid completion, else t. */) #if 0 /* How the below code used to look, for reference. */ tem = Fminibuffer_contents (); - b = XSTRING (tem)->data; - i = ZV - 1 - XSTRING (completion)->size; - p = XSTRING (completion)->data; + b = SDATA (tem); + i = ZV - 1 - SCHARS (completion); + p = SDATA (completion); if (i > 0 || 0 <= scmp (b, p, ZV - 1)) { @@ -1996,8 +1996,8 @@ Return nil if there is no valid completion, else t. */) Finsert (1, &tem); } } - buffer_nchars = XSTRING (tem)->size; /* # chars in what we completed. */ - completion_nchars = XSTRING (completion)->size; + buffer_nchars = SCHARS (tem); /* # chars in what we completed. */ + completion_nchars = SCHARS (completion); i = buffer_nchars - completion_nchars; if (i > 0 || @@ -2042,7 +2042,7 @@ Return nil if there is no valid completion, else t. */) /* If completion finds next char not unique, consider adding a space or a hyphen. */ - if (i == XSTRING (completion)->size) + if (i == SCHARS (completion)) { GCPRO1 (completion); tem = Ftry_completion (concat2 (minibuffer_completion_contents (), @@ -2072,9 +2072,9 @@ Return nil if there is no valid completion, else t. */) i gets index in string of where to stop completing. */ { int len, c; - int bytes = STRING_BYTES (XSTRING (completion)); - completion_string = XSTRING (completion)->data; - for (; i_byte < STRING_BYTES (XSTRING (completion)); i_byte += len, i++) + int bytes = SBYTES (completion); + completion_string = SDATA (completion); + for (; i_byte < SBYTES (completion); i_byte += len, i++) { c = STRING_CHAR_AND_LENGTH (completion_string + i_byte, bytes - i_byte, @@ -2100,7 +2100,7 @@ Return nil if there is no valid completion, else t. */) /* Otherwise insert in minibuffer the chars we got */ if (! NILP (Vminibuffer_completing_file_name) - && XSTRING (completion)->data[STRING_BYTES (XSTRING (completion)) - 1] == '/' + && SREF (completion, SBYTES (completion) - 1) == '/' && PT < ZV && FETCH_CHAR (PT_BYTE) == '/') { @@ -2163,16 +2163,16 @@ It can find the completion buffer in `standard-output'. */) { tem = XCAR (elt); CHECK_STRING (tem); - length = XSTRING (tem)->size; + length = SCHARS (tem); tem = Fcar (XCDR (elt)); CHECK_STRING (tem); - length += XSTRING (tem)->size; + length += SCHARS (tem); } else { CHECK_STRING (elt); - length = XSTRING (elt)->size; + length = SCHARS (elt); } /* This does a bad job for narrower than usual windows. @@ -2400,7 +2400,7 @@ or until the next input event arrives, whichever comes first. */) (string) Lisp_Object string; { - temp_echo_area_glyphs (XSTRING (string)->data); + temp_echo_area_glyphs (SDATA (string)); return Qnil; } diff --git a/src/msdos.c b/src/msdos.c index 5f261937008..b3cf0e9f345 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1454,9 +1454,9 @@ IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p) end = glyph + row->used[TEXT_AREA]; if (glyph < end && STRINGP (glyph->object) - && XSTRING (glyph->object)->intervals + && STRING_INTERVALS (glyph->object) && glyph->charpos >= 0 - && glyph->charpos < XSTRING (glyph->object)->size) + && glyph->charpos < SCHARS (glyph->object)) { /* If we're on a string with `help-echo' text property, arrange for the help to be displayed. This is done by @@ -1738,7 +1738,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y) else if (NILP (help) && ((STRINGP (glyph->object) && glyph->charpos >= 0 - && glyph->charpos < XSTRING (glyph->object)->size) + && glyph->charpos < SCHARS (glyph->object)) || (BUFFERP (glyph->object) && glyph->charpos >= BEGV && glyph->charpos < ZV))) @@ -2454,7 +2454,7 @@ IT_set_frame_parameters (f, alist) { x_set_title (f, val); if (termscript) - fprintf (termscript, "<TITLE: %s>\n", XSTRING (val)->data); + fprintf (termscript, "<TITLE: %s>\n", SDATA (val)); } else if (EQ (prop, Qcursor_type)) { @@ -4405,7 +4405,7 @@ The argument object is never altered--the value is a copy. */) return Qnil; tem = Fcopy_sequence (filename); - msdos_downcase_filename (XSTRING (tem)->data); + msdos_downcase_filename (SDATA (tem)); return tem; } diff --git a/src/print.c b/src/print.c index 1a68eaa9942..dbbeec97b4e 100644 --- a/src/print.c +++ b/src/print.c @@ -290,7 +290,7 @@ static Lisp_Object print_unwind (saved_text) Lisp_Object saved_text; { - bcopy (XSTRING (saved_text)->data, print_buffer, XSTRING (saved_text)->size); + bcopy (SDATA (saved_text), print_buffer, SCHARS (saved_text)); return Qnil; } @@ -461,7 +461,7 @@ print_string (string, printcharfun) int chars; if (STRING_MULTIBYTE (string)) - chars = XSTRING (string)->size; + chars = SCHARS (string); else if (EQ (printcharfun, Qt) ? ! NILP (buffer_defaults.enable_multibyte_characters) : ! NILP (current_buffer->enable_multibyte_characters)) @@ -472,22 +472,22 @@ print_string (string, printcharfun) Lisp_Object newstr; int bytes; - chars = STRING_BYTES (XSTRING (string)); - bytes = parse_str_to_multibyte (XSTRING (string)->data, chars); + chars = SBYTES (string); + bytes = parse_str_to_multibyte (SDATA (string), chars); if (chars < bytes) { newstr = make_uninit_multibyte_string (chars, bytes); - bcopy (XSTRING (string)->data, XSTRING (newstr)->data, chars); - str_to_multibyte (XSTRING (newstr)->data, bytes, chars); + bcopy (SDATA (string), SDATA (newstr), chars); + str_to_multibyte (SDATA (newstr), bytes, chars); string = newstr; } } else - chars = STRING_BYTES (XSTRING (string)); + chars = SBYTES (string); /* strout is safe for output to a frame (echo area) or to print_buffer. */ - strout (XSTRING (string)->data, - chars, STRING_BYTES (XSTRING (string)), + strout (SDATA (string), + chars, SBYTES (string), printcharfun, STRING_MULTIBYTE (string)); } else @@ -495,24 +495,24 @@ print_string (string, printcharfun) /* Otherwise, string may be relocated by printing one char. So re-fetch the string address for each character. */ int i; - int size = XSTRING (string)->size; - int size_byte = STRING_BYTES (XSTRING (string)); + int size = SCHARS (string); + int size_byte = SBYTES (string); struct gcpro gcpro1; GCPRO1 (string); if (size == size_byte) for (i = 0; i < size; i++) - PRINTCHAR (XSTRING (string)->data[i]); + PRINTCHAR (SREF (string, i)); else for (i = 0; i < size_byte; i++) { /* Here, we must convert each multi-byte form to the corresponding character code before handing it to PRINTCHAR. */ int len; - int ch = STRING_CHAR_AND_LENGTH (XSTRING (string)->data + i, + int ch = STRING_CHAR_AND_LENGTH (SDATA (string) + i, size_byte - i, len); if (!CHAR_VALID_P (ch, 0)) { - ch = XSTRING (string)->data[i]; + ch = SREF (string, i); len = 1; } PRINTCHAR (ch); @@ -664,7 +664,7 @@ usage: (with-output-to-temp-buffer BUFFNAME BODY ...) */) GCPRO1(args); name = Feval (Fcar (args)); CHECK_STRING (name); - temp_output_buffer_setup (XSTRING (name)->data); + temp_output_buffer_setup (SDATA (name)); buf = Vstandard_output; UNGCPRO; @@ -1074,7 +1074,7 @@ float_to_string (buf, data) /* Check that the spec we have is fully valid. This means not only valid for printf, but meant for floats, and reasonable. */ - cp = XSTRING (Vfloat_output_format)->data; + cp = SDATA (Vfloat_output_format); if (cp[0] != '%') goto lose; @@ -1104,7 +1104,7 @@ float_to_string (buf, data) if (cp[1] != 0) goto lose; - sprintf (buf, XSTRING (Vfloat_output_format)->data, data); + sprintf (buf, SDATA (Vfloat_output_format), data); } /* Make sure there is a decimal point with digit after, or an @@ -1243,7 +1243,7 @@ print_preprocess (obj) { case Lisp_String: /* A string may have text properties, which can be circular. */ - traverse_intervals_noorder (XSTRING (obj)->intervals, + traverse_intervals_noorder (STRING_INTERVALS (obj), print_preprocess_string, Qnil); break; @@ -1379,15 +1379,15 @@ print_object (obj, printcharfun, escapeflag) GCPRO1 (obj); - if (!NULL_INTERVAL_P (XSTRING (obj)->intervals)) + if (!NULL_INTERVAL_P (STRING_INTERVALS (obj))) { PRINTCHAR ('#'); PRINTCHAR ('('); } PRINTCHAR ('\"'); - str = XSTRING (obj)->data; - size_byte = STRING_BYTES (XSTRING (obj)); + str = SDATA (obj); + size_byte = SBYTES (obj); for (i = 0, i_byte = 0; i_byte < size_byte;) { @@ -1467,9 +1467,9 @@ print_object (obj, printcharfun, escapeflag) } PRINTCHAR ('\"'); - if (!NULL_INTERVAL_P (XSTRING (obj)->intervals)) + if (!NULL_INTERVAL_P (STRING_INTERVALS (obj))) { - traverse_intervals (XSTRING (obj)->intervals, + traverse_intervals (STRING_INTERVALS (obj), 0, print_interval, printcharfun); PRINTCHAR (')'); } @@ -1481,8 +1481,8 @@ print_object (obj, printcharfun, escapeflag) case Lisp_Symbol: { register int confusing; - register unsigned char *p = XSTRING (SYMBOL_NAME (obj))->data; - register unsigned char *end = p + STRING_BYTES (XSTRING (SYMBOL_NAME (obj))); + register unsigned char *p = SDATA (SYMBOL_NAME (obj)); + register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj)); register int c; int i, i_byte, size_byte; Lisp_Object name; @@ -1517,7 +1517,7 @@ print_object (obj, printcharfun, escapeflag) PRINTCHAR (':'); } - size_byte = STRING_BYTES (XSTRING (name)); + size_byte = SBYTES (name); for (i = 0, i_byte = 0; i_byte < size_byte;) { @@ -1735,9 +1735,9 @@ print_object (obj, printcharfun, escapeflag) { PRINTCHAR (' '); PRINTCHAR ('\''); - strout (XSTRING (SYMBOL_NAME (h->test))->data, -1, -1, printcharfun, 0); + strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun, 0); PRINTCHAR (' '); - strout (XSTRING (SYMBOL_NAME (h->weak))->data, -1, -1, printcharfun, 0); + strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0); PRINTCHAR (' '); sprintf (buf, "%d/%d", XFASTINT (h->count), XVECTOR (h->next)->size); diff --git a/src/process.c b/src/process.c index 771a4e1fe62..df6646e0b62 100644 --- a/src/process.c +++ b/src/process.c @@ -419,7 +419,7 @@ status_message (status) signame = "unknown"; string = build_string (signame); string2 = build_string (coredump ? " (core dumped)\n" : "\n"); - XSTRING (string)->data[0] = DOWNCASE (XSTRING (string)->data[0]); + SREF (string, 0) = DOWNCASE (SREF (string, 0)); return concat2 (string, string2); } else if (EQ (symbol, Qexit)) @@ -637,7 +637,7 @@ get_process (name) if (NILP (obj)) obj = Fget_buffer (name); if (NILP (obj)) - error ("Process %s does not exist", XSTRING (name)->data); + error ("Process %s does not exist", SDATA (name)); } else if (NILP (name)) obj = Fcurrent_buffer (); @@ -650,7 +650,7 @@ get_process (name) { proc = Fget_buffer_process (obj); if (NILP (proc)) - error ("Buffer %s has no process", XSTRING (XBUFFER (obj)->name)->data); + error ("Buffer %s has no process", SDATA (XBUFFER (obj)->name)); } else { @@ -1070,17 +1070,17 @@ list_processes_1 (query_only) if (!NILP (query_only) && !NILP (p->kill_without_query)) continue; if (STRINGP (p->name) - && ( i = XSTRING (p->name)->size, (i > w_proc))) + && ( i = SCHARS (p->name), (i > w_proc))) w_proc = i; if (!NILP (p->buffer)) { if (NILP (XBUFFER (p->buffer)->name) && w_buffer < 8) w_buffer = 8; /* (Killed) */ - else if ((i = XSTRING (XBUFFER (p->buffer)->name)->size, (i > w_buffer))) + else if ((i = SCHARS (XBUFFER (p->buffer)->name), (i > w_buffer))) w_buffer = i; } if (STRINGP (p->tty_name) - && (i = XSTRING (p->tty_name)->size, (i > w_tty))) + && (i = SCHARS (p->tty_name), (i > w_tty))) w_tty = i; } @@ -1206,7 +1206,7 @@ list_processes_1 (query_only) port = Fnumber_to_string (port); sprintf (tembuf, "(network %s server on %s)\n", (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), - XSTRING (port)->data); + SDATA (port)); insert_string (tembuf); } else if (NETCONN1_P (p)) @@ -1222,7 +1222,7 @@ list_processes_1 (query_only) } sprintf (tembuf, "(network %s connection to %s)\n", (DATAGRAM_CHAN_P (XINT (p->infd)) ? "datagram" : "stream"), - XSTRING (host)->data); + SDATA (host)); insert_string (tembuf); } else @@ -1400,21 +1400,21 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) #ifdef VMS /* Make a one member argv with all args concatenated together separated by a blank. */ - len = STRING_BYTES (XSTRING (program)) + 2; + len = SBYTES (program) + 2; for (i = 3; i < nargs; i++) { tem = args[i]; CHECK_STRING (tem); - len += STRING_BYTES (XSTRING (tem)) + 1; /* count the blank */ + len += SBYTES (tem) + 1; /* count the blank */ } new_argv = (unsigned char *) alloca (len); - strcpy (new_argv, XSTRING (program)->data); + strcpy (new_argv, SDATA (program)); for (i = 3; i < nargs; i++) { tem = args[i]; CHECK_STRING (tem); strcat (new_argv, " "); - strcat (new_argv, XSTRING (tem)->data); + strcat (new_argv, SDATA (tem)); } /* Need to add code here to check for program existence on VMS */ @@ -1422,9 +1422,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *)); /* If program file name is not absolute, search our path for it */ - if (!IS_DIRECTORY_SEP (XSTRING (program)->data[0]) - && !(XSTRING (program)->size > 1 - && IS_DEVICE_SEP (XSTRING (program)->data[1]))) + if (!IS_DIRECTORY_SEP (SREF (program, 0)) + && !(SCHARS (program) > 1 + && IS_DEVICE_SEP (SREF (program, 1)))) { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; @@ -1436,7 +1436,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) report_file_error ("Searching for program", Fcons (program, Qnil)); tem = Fexpand_file_name (tem, Qnil); tem = ENCODE_FILE (tem); - new_argv[0] = XSTRING (tem)->data; + new_argv[0] = SDATA (tem); } else { @@ -1444,7 +1444,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) error ("Specified program for new process is a directory"); tem = ENCODE_FILE (program); - new_argv[0] = XSTRING (tem)->data; + new_argv[0] = SDATA (tem); } /* Here we encode arguments by the coding system used for sending @@ -1459,7 +1459,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) if (STRING_MULTIBYTE (tem)) tem = (code_convert_string_norecord (tem, XPROCESS (proc)->encode_coding_system, 1)); - new_argv[i - 2] = XSTRING (tem)->data; + new_argv[i - 2] = SDATA (tem); } new_argv[i - 2] = 0; #endif /* not VMS */ @@ -2092,7 +2092,7 @@ conv_lisp_to_sockaddr (family, address, sa, len) if (family == AF_LOCAL) { struct sockaddr_un *sockun = (struct sockaddr_un *) sa; - cp = XSTRING (address)->data; + cp = SDATA (address); for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++) sockun->sun_path[i] = *cp++; } @@ -2232,9 +2232,9 @@ set_socket_options (s, opts, no_error) opt = XCAR (opt); } if (STRINGP (opt)) - name = (char *) XSTRING (opt)->data; + name = (char *) SDATA (opt); else if (SYMBOLP (opt)) - name = (char *) XSTRING (SYMBOL_NAME (opt))->data; + name = (char *) SDATA (SYMBOL_NAME (opt)); else { error ("Mal-formed option list"); return 0; @@ -2300,9 +2300,9 @@ set_socket_options (s, opts, no_error) if (NILP (val)) arg = ""; else if (STRINGP (val)) - arg = (char *) XSTRING (val)->data; + arg = (char *) SDATA (val); else if (XSYMBOL (val)) - arg = (char *) XSTRING (SYMBOL_NAME (val))->data; + arg = (char *) SDATA (SYMBOL_NAME (val)); else error ("Invalid argument to %s option", name); } @@ -2632,16 +2632,16 @@ usage: (make-network-process &rest ARGS) */) { struct servent *svc_info; CHECK_STRING (service); - svc_info = getservbyname (XSTRING (service)->data, "tcp"); + svc_info = getservbyname (SDATA (service), "tcp"); if (svc_info == 0) - error ("Unknown service: %s", XSTRING (service)->data); + error ("Unknown service: %s", SDATA (service)); port = svc_info->s_port; } s = connect_server (0); if (s < 0) report_file_error ("error creating socket", Fcons (name, Qnil)); - send_command (s, C_PORT, 0, "%s:%d", XSTRING (host)->data, ntohs (port)); + send_command (s, C_PORT, 0, "%s:%d", SDATA (host), ntohs (port)); send_command (s, C_DUMB, 1, 0); #else /* not TERM */ @@ -2694,7 +2694,7 @@ usage: (make-network-process &rest ARGS) */) CHECK_STRING (service); bzero (&address_un, sizeof address_un); address_un.sun_family = AF_LOCAL; - strncpy (address_un.sun_path, XSTRING (service)->data, sizeof address_un.sun_path); + strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path); ai.ai_addr = (struct sockaddr *) &address_un; ai.ai_addrlen = sizeof address_un; goto open_socket; @@ -2739,7 +2739,7 @@ usage: (make-network-process &rest ARGS) */) else { CHECK_STRING (service); - portstring = XSTRING (service)->data; + portstring = SDATA (service); } immediate_quit = 1; @@ -2749,12 +2749,12 @@ usage: (make-network-process &rest ARGS) */) hints.ai_family = NILP (Fplist_member (contact, QCfamily)) ? AF_UNSPEC : family; hints.ai_socktype = socktype; hints.ai_protocol = 0; - ret = getaddrinfo (XSTRING (host)->data, portstring, &hints, &res); + ret = getaddrinfo (SDATA (host), portstring, &hints, &res); if (ret) #ifdef HAVE_GAI_STRERROR - error ("%s/%s %s", XSTRING (host)->data, portstring, gai_strerror(ret)); + error ("%s/%s %s", SDATA (host), portstring, gai_strerror(ret)); #else - error ("%s/%s getaddrinfo error %d", XSTRING (host)->data, portstring, ret); + error ("%s/%s getaddrinfo error %d", SDATA (host), portstring, ret); #endif immediate_quit = 0; @@ -2773,10 +2773,10 @@ usage: (make-network-process &rest ARGS) */) { struct servent *svc_info; CHECK_STRING (service); - svc_info = getservbyname (XSTRING (service)->data, + svc_info = getservbyname (SDATA (service), (socktype == SOCK_DGRAM ? "udp" : "tcp")); if (svc_info == 0) - error ("Unknown service: %s", XSTRING (service)->data); + error ("Unknown service: %s", SDATA (service)); port = svc_info->s_port; } @@ -2794,7 +2794,7 @@ usage: (make-network-process &rest ARGS) */) as it may `hang' emacs for a very long time. */ immediate_quit = 1; QUIT; - host_info_ptr = gethostbyname (XSTRING (host)->data); + host_info_ptr = gethostbyname (SDATA (host)); immediate_quit = 0; if (host_info_ptr) @@ -2808,9 +2808,9 @@ usage: (make-network-process &rest ARGS) */) /* Attempt to interpret host as numeric inet address */ { IN_ADDR numeric_addr; - numeric_addr = inet_addr ((char *) XSTRING (host)->data); + numeric_addr = inet_addr ((char *) SDATA (host)); if (NUMERIC_ADDR_ERROR) - error ("Unknown host \"%s\"", XSTRING (host)->data); + error ("Unknown host \"%s\"", SDATA (host)); bcopy ((char *)&numeric_addr, (char *) &address_in.sin_addr, sizeof (address_in.sin_addr)); @@ -4283,7 +4283,7 @@ read_process_output (proc, channel) the tail of decoding buffer) should be prepended to the new data read to decode all together. */ chars = (char *) alloca (nbytes + carryover); - bcopy (XSTRING (p->decoding_buf)->data, buf, carryover); + bcopy (SDATA (p->decoding_buf), buf, carryover); bcopy (vs->inputBuffer, chars + carryover, nbytes); } #else /* not VMS */ @@ -4301,7 +4301,7 @@ read_process_output (proc, channel) chars = (char *) alloca (carryover + readmax); if (carryover) /* See the comment above. */ - bcopy (XSTRING (p->decoding_buf)->data, chars, carryover); + bcopy (SDATA (p->decoding_buf), chars, carryover); #ifdef DATAGRAM_SOCKETS /* We have a working select, so proc_buffered_char is always -1. */ @@ -4414,11 +4414,11 @@ read_process_output (proc, channel) } carryover = nbytes - coding->consumed; - bcopy (chars + coding->consumed, XSTRING (p->decoding_buf)->data, + bcopy (chars + coding->consumed, SDATA (p->decoding_buf), carryover); XSETINT (p->decoding_carryover, carryover); - nbytes = STRING_BYTES (XSTRING (text)); - nchars = XSTRING (text)->size; + nbytes = SBYTES (text); + nchars = SCHARS (text); if (nbytes > 0) internal_condition_case_1 (read_process_output_call, Fcons (outstream, @@ -4515,7 +4515,7 @@ read_process_output (proc, channel) } } carryover = nbytes - coding->consumed; - bcopy (chars + coding->consumed, XSTRING (p->decoding_buf)->data, + bcopy (chars + coding->consumed, SDATA (p->decoding_buf), carryover); XSETINT (p->decoding_carryover, carryover); /* Adjust the multibyteness of TEXT to that of the buffer. */ @@ -4524,8 +4524,8 @@ read_process_output (proc, channel) text = (STRING_MULTIBYTE (text) ? Fstring_as_unibyte (text) : Fstring_as_multibyte (text)); - nbytes = STRING_BYTES (XSTRING (text)); - nchars = XSTRING (text)->size; + nbytes = SBYTES (text); + nchars = SCHARS (text); /* Insert before markers in case we are inserting where the buffer's mark is, and the user's next command is Meta-y. */ insert_from_string_before_markers (text, 0, 0, nchars, nbytes, 0); @@ -4633,10 +4633,10 @@ send_process (proc, buf, len, object) update_status (XPROCESS (proc)); if (! EQ (XPROCESS (proc)->status, Qrun)) error ("Process %s not running", - XSTRING (XPROCESS (proc)->name)->data); + SDATA (XPROCESS (proc)->name)); if (XINT (XPROCESS (proc)->outfd) < 0) error ("Output file descriptor of %s is closed", - XSTRING (XPROCESS (proc)->name)->data); + SDATA (XPROCESS (proc)->name)); coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; Vlast_coding_system_used = coding->symbol; @@ -4691,7 +4691,7 @@ send_process (proc, buf, len, object) } else if (STRINGP (object)) { - from_byte = buf - XSTRING (object)->data; + from_byte = buf - SDATA (object); from = string_byte_to_char (object, from_byte); to = string_byte_to_char (object, from_byte + len); } @@ -4704,19 +4704,19 @@ send_process (proc, buf, len, object) coding->composing = COMPOSITION_DISABLED; } - if (STRING_BYTES (XSTRING (XPROCESS (proc)->encoding_buf)) < require) + if (SBYTES (XPROCESS (proc)->encoding_buf) < require) XPROCESS (proc)->encoding_buf = make_uninit_string (require); if (from_byte >= 0) buf = (BUFFERP (object) ? BUF_BYTE_ADDRESS (XBUFFER (object), from_byte) - : XSTRING (object)->data + from_byte); + : SDATA (object) + from_byte); object = XPROCESS (proc)->encoding_buf; - encode_coding (coding, (char *) buf, XSTRING (object)->data, - len, STRING_BYTES (XSTRING (object))); + encode_coding (coding, (char *) buf, SDATA (object), + len, SBYTES (object)); len = coding->produced; - buf = XSTRING (object)->data; + buf = SDATA (object); if (temp_buf) xfree (temp_buf); } @@ -4849,7 +4849,7 @@ send_process (proc, buf, len, object) if (BUFFERP (object)) offset = BUF_PTR_BYTE_POS (XBUFFER (object), buf); else if (STRINGP (object)) - offset = buf - XSTRING (object)->data; + offset = buf - SDATA (object); XSETFASTINT (zero, 0); #ifdef EMACS_HAS_USECS @@ -4861,7 +4861,7 @@ send_process (proc, buf, len, object) if (BUFFERP (object)) buf = BUF_BYTE_ADDRESS (XBUFFER (object), offset); else if (STRINGP (object)) - buf = offset + XSTRING (object)->data; + buf = offset + SDATA (object); rv = 0; } @@ -4893,10 +4893,10 @@ send_process (proc, buf, len, object) deactivate_process (proc); #ifdef VMS error ("Error writing to process %s; closed it", - XSTRING (XPROCESS (proc)->name)->data); + SDATA (XPROCESS (proc)->name)); #else error ("SIGPIPE raised on process %s; closed it", - XSTRING (XPROCESS (proc)->name)->data); + SDATA (XPROCESS (proc)->name)); #endif } @@ -4946,8 +4946,8 @@ Output from processes can arrive in between bunches. */) Lisp_Object proc; CHECK_STRING (string); proc = get_process (process); - send_process (proc, XSTRING (string)->data, - STRING_BYTES (XSTRING (string)), string); + send_process (proc, SDATA (string), + SBYTES (string), string); return Qnil; } @@ -4970,10 +4970,10 @@ return t unconditionally. */) if (!EQ (p->childp, Qt)) error ("Process %s is not a subprocess", - XSTRING (p->name)->data); + SDATA (p->name)); if (XINT (p->infd) < 0) error ("Process %s is not active", - XSTRING (p->name)->data); + SDATA (p->name)); #ifdef TIOCGPGRP if (!NILP (p->subtty)) @@ -5018,10 +5018,10 @@ process_send_signal (process, signo, current_group, nomsg) if (!EQ (p->childp, Qt)) error ("Process %s is not a subprocess", - XSTRING (p->name)->data); + SDATA (p->name)); if (XINT (p->infd) < 0) error ("Process %s is not active", - XSTRING (p->name)->data); + SDATA (p->name)); if (NILP (p->pty_flag)) current_group = Qnil; @@ -5337,7 +5337,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) unsigned char *name; CHECK_SYMBOL (sigcode); - name = XSTRING (SYMBOL_NAME (sigcode))->data; + name = SDATA (SYMBOL_NAME (sigcode)); if (0) ; @@ -5464,7 +5464,7 @@ text to PROCESS after you call this function. */) if (! NILP (XPROCESS (proc)->raw_status_low)) update_status (XPROCESS (proc)); if (! EQ (XPROCESS (proc)->status, Qrun)) - error ("Process %s not running", XSTRING (XPROCESS (proc)->name)->data); + error ("Process %s not running", SDATA (XPROCESS (proc)->name)); if (CODING_REQUIRE_FLUSHING (coding)) { @@ -5946,9 +5946,9 @@ encode subprocess input. */) CHECK_PROCESS (proc); p = XPROCESS (proc); if (XINT (p->infd) < 0) - error ("Input file descriptor of %s closed", XSTRING (p->name)->data); + error ("Input file descriptor of %s closed", SDATA (p->name)); if (XINT (p->outfd) < 0) - error ("Output file descriptor of %s closed", XSTRING (p->name)->data); + error ("Output file descriptor of %s closed", SDATA (p->name)); p->decode_coding_system = Fcheck_coding_system (decoding); p->encode_coding_system = Fcheck_coding_system (encoding); diff --git a/src/search.c b/src/search.c index 643a57d59ca..7ccdab568e1 100644 --- a/src/search.c +++ b/src/search.c @@ -128,16 +128,16 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) if (multibyte == STRING_MULTIBYTE (pattern)) { - raw_pattern = (unsigned char *) XSTRING (pattern)->data; - raw_pattern_size = STRING_BYTES (XSTRING (pattern)); + raw_pattern = (unsigned char *) SDATA (pattern); + raw_pattern_size = SBYTES (pattern); } else if (multibyte) { - raw_pattern_size = count_size_as_multibyte (XSTRING (pattern)->data, - XSTRING (pattern)->size); + raw_pattern_size = count_size_as_multibyte (SDATA (pattern), + SCHARS (pattern)); raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); - copy_text (XSTRING (pattern)->data, raw_pattern, - XSTRING (pattern)->size, 0, 1); + copy_text (SDATA (pattern), raw_pattern, + SCHARS (pattern), 0, 1); } else { @@ -147,10 +147,10 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) by subtracting nonascii-insert-offset from each non-ASCII char, so that only the multibyte chars which really correspond to the chosen single-byte character set can possibly match. */ - raw_pattern_size = XSTRING (pattern)->size; + raw_pattern_size = SCHARS (pattern); raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); - copy_text (XSTRING (pattern)->data, raw_pattern, - STRING_BYTES (XSTRING (pattern)), 1, 0); + copy_text (SDATA (pattern), raw_pattern, + SBYTES (pattern), 1, 0); } cp->regexp = Qnil; @@ -217,7 +217,7 @@ compile_pattern (pattern, regp, translate, posix, multibyte) should never appear before a non-nil entry. */ if (NILP (cp->regexp)) goto compile_it; - if (XSTRING (cp->regexp)->size == XSTRING (pattern)->size + if (SCHARS (cp->regexp) == SCHARS (pattern) && STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern) && !NILP (Fstring_equal (cp->regexp, pattern)) && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) @@ -372,7 +372,7 @@ string_match_1 (regexp, string, start, posix) pos = 0, pos_byte = 0; else { - int len = XSTRING (string)->size; + int len = SCHARS (string); CHECK_NUMBER (start); pos = XINT (start); @@ -391,9 +391,9 @@ string_match_1 (regexp, string, start, posix) immediate_quit = 1; re_match_object = string; - val = re_search (bufp, (char *) XSTRING (string)->data, - STRING_BYTES (XSTRING (string)), pos_byte, - STRING_BYTES (XSTRING (string)) - pos_byte, + val = re_search (bufp, (char *) SDATA (string), + SBYTES (string), pos_byte, + SBYTES (string) - pos_byte, &search_regs); immediate_quit = 0; last_thing_searched = Qt; @@ -456,9 +456,9 @@ fast_string_match (regexp, string) immediate_quit = 1; re_match_object = string; - val = re_search (bufp, (char *) XSTRING (string)->data, - STRING_BYTES (XSTRING (string)), 0, - STRING_BYTES (XSTRING (string)), 0); + val = re_search (bufp, (char *) SDATA (string), + SBYTES (string), 0, + SBYTES (string), 0); immediate_quit = 0; return val; } @@ -939,8 +939,8 @@ static int trivial_regexp_p (regexp) Lisp_Object regexp; { - int len = STRING_BYTES (XSTRING (regexp)); - unsigned char *s = XSTRING (regexp)->data; + int len = SBYTES (regexp); + unsigned char *s = SDATA (regexp); while (--len >= 0) { switch (*s++) @@ -1011,8 +1011,8 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, Lisp_Object inverse_trt; int posix; { - int len = XSTRING (string)->size; - int len_byte = STRING_BYTES (XSTRING (string)); + int len = SCHARS (string); + int len_byte = SBYTES (string); register int i; if (running_asynch_code) @@ -1136,7 +1136,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, int raw_pattern_size_byte; unsigned char *patbuf; int multibyte = !NILP (current_buffer->enable_multibyte_characters); - unsigned char *base_pat = XSTRING (string)->data; + unsigned char *base_pat = SDATA (string); int charset_base = -1; int boyer_moore_ok = 1; @@ -1146,19 +1146,19 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, if (multibyte == STRING_MULTIBYTE (string)) { - raw_pattern = (unsigned char *) XSTRING (string)->data; - raw_pattern_size = XSTRING (string)->size; - raw_pattern_size_byte = STRING_BYTES (XSTRING (string)); + raw_pattern = (unsigned char *) SDATA (string); + raw_pattern_size = SCHARS (string); + raw_pattern_size_byte = SBYTES (string); } else if (multibyte) { - raw_pattern_size = XSTRING (string)->size; + raw_pattern_size = SCHARS (string); raw_pattern_size_byte - = count_size_as_multibyte (XSTRING (string)->data, + = count_size_as_multibyte (SDATA (string), raw_pattern_size); raw_pattern = (unsigned char *) alloca (raw_pattern_size_byte + 1); - copy_text (XSTRING (string)->data, raw_pattern, - XSTRING (string)->size, 0, 1); + copy_text (SDATA (string), raw_pattern, + SCHARS (string), 0, 1); } else { @@ -1168,11 +1168,11 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, by subtracting nonascii-insert-offset from each non-ASCII char, so that only the multibyte chars which really correspond to the chosen single-byte character set can possibly match. */ - raw_pattern_size = XSTRING (string)->size; - raw_pattern_size_byte = XSTRING (string)->size; + raw_pattern_size = SCHARS (string); + raw_pattern_size_byte = SCHARS (string); raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); - copy_text (XSTRING (string)->data, raw_pattern, - STRING_BYTES (XSTRING (string)), 1, 0); + copy_text (SDATA (string), raw_pattern, + SBYTES (string), 1, 0); } /* Copy and optionally translate the pattern. */ @@ -1948,8 +1948,8 @@ wordify (string) int adjust; CHECK_STRING (string); - p = XSTRING (string)->data; - len = XSTRING (string)->size; + p = SDATA (string); + len = SCHARS (string); for (i = 0, i_byte = 0; i < len; ) { @@ -1975,12 +1975,12 @@ wordify (string) adjust = - punct_count + 5 * (word_count - 1) + 4; if (STRING_MULTIBYTE (string)) val = make_uninit_multibyte_string (len + adjust, - STRING_BYTES (XSTRING (string)) + SBYTES (string) + adjust); else val = make_uninit_string (len + adjust); - o = XSTRING (val)->data; + o = SDATA (val); *o++ = '\\'; *o++ = 'b'; prev_c = 0; @@ -1994,7 +1994,7 @@ wordify (string) if (SYNTAX (c) == Sword) { - bcopy (&XSTRING (string)->data[i_byte_orig], o, + bcopy (&SREF (string, i_byte_orig), o, i_byte - i_byte_orig); o += i_byte - i_byte_orig; } @@ -2242,7 +2242,7 @@ since only regular expressions have distinguished subexpressions. */) { if (search_regs.start[sub] < 0 || search_regs.start[sub] > search_regs.end[sub] - || search_regs.end[sub] > XSTRING (string)->size) + || search_regs.end[sub] > SCHARS (string)) args_out_of_range (make_number (search_regs.start[sub]), make_number (search_regs.end[sub])); } @@ -2342,7 +2342,7 @@ since only regular expressions have distinguished subexpressions. */) /* We build up the substituted string in ACCUM. */ Lisp_Object accum; Lisp_Object middle; - int length = STRING_BYTES (XSTRING (newtext)); + int length = SBYTES (newtext); accum = Qnil; @@ -2434,7 +2434,7 @@ since only regular expressions have distinguished subexpressions. */) perform substitution on the replacement string. */ if (NILP (literal)) { - int length = STRING_BYTES (XSTRING (newtext)); + int length = SBYTES (newtext); unsigned char *substed; int substed_alloc_size, substed_len; int buf_multibyte = !NILP (current_buffer->enable_multibyte_characters); @@ -2471,7 +2471,7 @@ since only regular expressions have distinguished subexpressions. */) else { /* Note that we don't have to increment POS. */ - c = XSTRING (newtext)->data[pos_byte++]; + c = SDATA (newtext)[pos_byte++]; if (buf_multibyte) c = unibyte_char_to_multibyte (c); } @@ -2493,7 +2493,7 @@ since only regular expressions have distinguished subexpressions. */) } else { - c = XSTRING (newtext)->data[pos_byte++]; + c = SREF (newtext, pos_byte++); if (buf_multibyte) c = unibyte_char_to_multibyte (c); } @@ -2558,7 +2558,7 @@ since only regular expressions have distinguished subexpressions. */) /* Replace the old text with the new in the cleanest possible way. */ replace_range (search_regs.start[sub], search_regs.end[sub], newtext, 1, 0, 1); - newpoint = search_regs.start[sub] + XSTRING (newtext)->size; + newpoint = search_regs.start[sub] + SCHARS (newtext); if (case_action == all_caps) Fupcase_region (make_number (search_regs.start[sub]), @@ -2849,12 +2849,12 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0, CHECK_STRING (string); - temp = (unsigned char *) alloca (STRING_BYTES (XSTRING (string)) * 2); + temp = (unsigned char *) alloca (SBYTES (string) * 2); /* Now copy the data into the new string, inserting escapes. */ - in = XSTRING (string)->data; - end = in + STRING_BYTES (XSTRING (string)); + in = SDATA (string); + end = in + SBYTES (string); out = temp; for (; in != end; in++) @@ -2868,7 +2868,7 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0, } return make_specified_string (temp, - XSTRING (string)->size + backslashes_added, + SCHARS (string) + backslashes_added, out - temp, STRING_MULTIBYTE (string)); } diff --git a/src/sound.c b/src/sound.c index 90fe5f524c7..18d0403d49e 100644 --- a/src/sound.c +++ b/src/sound.c @@ -433,8 +433,8 @@ Internal use only, use `play-sound' instead. */) else { s.data = attrs[SOUND_DATA]; - s.header_size = min (MAX_SOUND_HEADER_BYTES, STRING_BYTES (XSTRING (s.data))); - bcopy (XSTRING (s.data)->data, s.header, s.header_size); + s.header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (s.data)); + bcopy (SDATA (s.data), s.header, s.header_size); } /* Find out the type of sound. Give up if we can't tell. */ @@ -443,9 +443,9 @@ Internal use only, use `play-sound' instead. */) /* Set up a device. */ if (STRINGP (attrs[SOUND_DEVICE])) { - int len = XSTRING (attrs[SOUND_DEVICE])->size; + int len = SCHARS (attrs[SOUND_DEVICE]); sd.file = (char *) alloca (len + 1); - strcpy (sd.file, XSTRING (attrs[SOUND_DEVICE])->data); + strcpy (sd.file, SDATA (attrs[SOUND_DEVICE])); } if (INTEGERP (attrs[SOUND_VOLUME])) @@ -624,8 +624,8 @@ wav_play (s, sd) files I found so far. If someone feels inclined to implement the whole RIFF-WAVE spec, please do. */ if (STRINGP (s->data)) - sd->write (sd, XSTRING (s->data)->data + sizeof *header, - STRING_BYTES (XSTRING (s->data)) - sizeof *header); + sd->write (sd, SDATA (s->data) + sizeof *header, + SBYTES (s->data) - sizeof *header); else { char *buffer; @@ -712,8 +712,8 @@ au_play (s, sd) sd->configure (sd); if (STRINGP (s->data)) - sd->write (sd, XSTRING (s->data)->data + header->data_offset, - STRING_BYTES (XSTRING (s->data)) - header->data_offset); + sd->write (sd, SDATA (s->data) + header->data_offset, + SBYTES (s->data) - header->data_offset); else { int blksize = 2048; diff --git a/src/sunfns.c b/src/sunfns.c index 51347aa42f5..e4e2e84da45 100644 --- a/src/sunfns.c +++ b/src/sunfns.c @@ -240,13 +240,13 @@ expressed as a string. If ICON is nil then the original arrow cursor is used. CHECK_NUMBER (X_Hot); CHECK_NUMBER (Y_Hot); CHECK_STRING (Data); - if (XSTRING(Data)->size != 32) return(Qnil); + if (SCHARS (Data) != 32) return(Qnil); /* * Setup the new cursor */ NewCursor.cur_xhot = X_Hot; NewCursor.cur_yhot = Y_Hot; - cp = XSTRING(Data)->data; + cp = SDATA (Data); p = CursorData; i = 16; while(--i >= 0) @@ -267,7 +267,7 @@ sel_write (sel, file) struct selection *sel; FILE *file; { - fwrite (XSTRING (Current_Selection)->data, sizeof (char), + fwrite (SDATA (Current_Selection), sizeof (char), sel->sel_items, file); } @@ -330,7 +330,7 @@ DEFUN ("sun-set-selection", Fsun_set_selection, Ssun_set_selection, 1, 1, CHECK_GFX (Qnil); selection.sel_type = SELTYPE_CHAR; - selection.sel_items = XSTRING (str)->size; + selection.sel_items = SCHARS (str); selection.sel_itembytes = 1; selection.sel_pubflags = 1; selection_set(&selection, sel_write, sel_clear, win_fd); @@ -371,10 +371,10 @@ sun_item_create (Pair) if (VECTORP (Value)) { submenu = sun_menu_create (Value); menu_item = menu_create_item - (MENU_RELEASE, MENU_PULLRIGHT_ITEM, XSTRING(String)->data, submenu, 0); + (MENU_RELEASE, MENU_PULLRIGHT_ITEM, SDATA (String), submenu, 0); } else { menu_item = menu_create_item - (MENU_RELEASE, MENU_STRING_ITEM, XSTRING(String)->data, Value, 0); + (MENU_RELEASE, MENU_STRING_ITEM, SDATA (String), Value, 0); } return menu_item; } diff --git a/src/syntax.c b/src/syntax.c index 30b9eb1f4c4..8d6b052f14b 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -908,7 +908,7 @@ text property. */) CHECK_STRING (string); - p = XSTRING (string)->data; + p = SDATA (string); code = (enum syntaxcode) syntax_spec_code[*p++]; if (((int) code & 0377) == 0377) error ("invalid syntax description letter: %c", p[-1]); @@ -920,7 +920,7 @@ text property. */) { int len; int character = (STRING_CHAR_AND_LENGTH - (p, STRING_BYTES (XSTRING (string)) - 1, len)); + (p, SBYTES (string) - 1, len)); XSETINT (match, character); if (XFASTINT (match) == ' ') match = Qnil; @@ -1369,10 +1369,10 @@ skip_chars (forwardp, syntaxp, string, lim) int len; CHECK_STRING (string); - char_ranges = (int *) alloca (XSTRING (string)->size * (sizeof (int)) * 2); + char_ranges = (int *) alloca (SCHARS (string) * (sizeof (int)) * 2); string_multibyte = STRING_MULTIBYTE (string); - str = XSTRING (string)->data; - size_byte = STRING_BYTES (XSTRING (string)); + str = SDATA (string); + size_byte = SBYTES (string); /* Adjust the multibyteness of the string to that of the buffer. */ if (multibyte != string_multibyte) @@ -1380,14 +1380,14 @@ skip_chars (forwardp, syntaxp, string, lim) int nbytes; if (multibyte) - nbytes = count_size_as_multibyte (XSTRING (string)->data, - XSTRING (string)->size); + nbytes = count_size_as_multibyte (SDATA (string), + SCHARS (string)); else - nbytes = XSTRING (string)->size; + nbytes = SCHARS (string); if (nbytes != size_byte) { str = (unsigned char *) alloca (nbytes); - copy_text (XSTRING (string)->data, str, size_byte, + copy_text (SDATA (string), str, size_byte, string_multibyte, multibyte); size_byte = nbytes; } @@ -1409,7 +1409,7 @@ skip_chars (forwardp, syntaxp, string, lim) i_byte = 0; if (i_byte < size_byte - && XSTRING (string)->data[0] == '^') + && SREF (string, 0) == '^') { negate = 1; i_byte++; } diff --git a/src/syntax.h b/src/syntax.h index 41f6662ddeb..4cbd2e2edf9 100644 --- a/src/syntax.h +++ b/src/syntax.h @@ -330,7 +330,7 @@ if (1) \ else \ { \ gl_state.b_property = 0; \ - gl_state.e_property = 1 + XSTRING (gl_state.object)->size; \ + gl_state.e_property = 1 + SCHARS (gl_state.object); \ gl_state.offset = 0; \ } \ gl_state.use_global = 0; \ diff --git a/src/sysdep.c b/src/sysdep.c index f2ac20ae4a5..9b49f72b4eb 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -795,9 +795,9 @@ sys_subshell () goto xyzzy; dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); - str = (unsigned char *) alloca (XSTRING (dir)->size + 2); - len = XSTRING (dir)->size; - bcopy (XSTRING (dir)->data, str, len); + str = (unsigned char *) alloca (SCHARS (dir) + 2); + len = SCHARS (dir); + bcopy (SDATA (dir), str, len); if (str[len - 1] != '/') str[len++] = '/'; str[len] = 0; xyzzy: @@ -2465,7 +2465,7 @@ init_system_name () #endif /* BSD4_1 */ { unsigned char *p; - for (p = XSTRING (Vsystem_name)->data; *p; p++) + for (p = SDATA (Vsystem_name); *p; p++) if (*p == ' ' || *p == '\t') *p = '-'; } diff --git a/src/textprop.c b/src/textprop.c index 3e742476a12..bf23f6a34aa 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -776,7 +776,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) if (NILP (position)) { if (NILP (limit)) - position = make_number (XSTRING (object)->size); + position = make_number (SCHARS (object)); else position = limit; } @@ -842,7 +842,7 @@ back past position LIMIT; return LIMIT if nothing is found before LIMIT. */) if (NILP (position)) { if (NILP (limit)) - position = make_number (XSTRING (object)->size); + position = make_number (SCHARS (object)); else position = limit; } @@ -935,7 +935,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) if (NULL_INTERVAL_P (next)) XSETFASTINT (position, (STRINGP (object) - ? XSTRING (object)->size + ? SCHARS (object) : BUF_ZV (XBUFFER (object)))); else XSETFASTINT (position, next->position); @@ -955,7 +955,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) return limit; if (NILP (limit)) XSETFASTINT (limit, (STRINGP (object) - ? XSTRING (object)->size + ? SCHARS (object) : BUF_ZV (XBUFFER (object)))); if (!(next->position < XFASTINT (limit))) return limit; @@ -1035,7 +1035,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) return limit; if (NILP (limit)) XSETFASTINT (limit, (STRINGP (object) - ? XSTRING (object)->size + ? SCHARS (object) : BUF_ZV (XBUFFER (object)))); if (!(next->position < XFASTINT (limit))) return limit; @@ -1306,12 +1306,12 @@ set_text_properties (start, end, properties, object, signal_after_change_p) get rid of its intervals. */ if (NILP (properties) && STRINGP (object) && XFASTINT (start) == 0 - && XFASTINT (end) == XSTRING (object)->size) + && XFASTINT (end) == SCHARS (object)) { - if (! XSTRING (object)->intervals) + if (! STRING_INTERVALS (object)) return Qt; - XSTRING (object)->intervals = 0; + STRING_INTERVALS (object) = 0; return Qt; } diff --git a/src/undo.c b/src/undo.c index 714c3022d96..edb07147a0a 100644 --- a/src/undo.c +++ b/src/undo.c @@ -142,7 +142,7 @@ record_delete (beg, string) if (EQ (current_buffer->undo_list, Qt)) return; - if (PT == beg + XSTRING (string)->size) + if (PT == beg + SCHARS (string)) { XSETINT (sbeg, -beg); record_point (PT); @@ -334,7 +334,7 @@ truncate_undo_list (list, minsize, maxsize) size_so_far += sizeof (struct Lisp_Cons); if (STRINGP (XCAR (elt))) size_so_far += (sizeof (struct Lisp_String) - 1 - + XSTRING (XCAR (elt))->size); + + SCHARS (XCAR (elt))); } /* Advance to next element. */ @@ -369,7 +369,7 @@ truncate_undo_list (list, minsize, maxsize) size_so_far += sizeof (struct Lisp_Cons); if (STRINGP (XCAR (elt))) size_so_far += (sizeof (struct Lisp_String) - 1 - + XSTRING (XCAR (elt))->size); + + SCHARS (XCAR (elt))); } /* Advance to next element. */ diff --git a/src/w16select.c b/src/w16select.c index 194efdf590d..bdbd38de575 100644 --- a/src/w16select.c +++ b/src/w16select.c @@ -501,12 +501,12 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat BLOCK_INPUT; - nbytes = STRING_BYTES (XSTRING (string)); - src = XSTRING (string)->data; + nbytes = SBYTES (string); + src = SDATA (string); /* Since we are now handling multilingual text, we must consider encoding text for the clipboard. */ - charset_info = find_charset_in_text (src, XSTRING (string)->size, nbytes, + charset_info = find_charset_in_text (src, SCHARS (string), nbytes, NULL, Qnil); if (charset_info == 0) @@ -531,8 +531,8 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat && !NILP (Ffboundp (coding.pre_write_conversion))) { string = run_pre_post_conversion_on_str (string, &coding, 1); - src = XSTRING (string)->data; - nbytes = STRING_BYTES (XSTRING (string)); + src = SDATA (string); + nbytes = SBYTES (string); } coding.src_multibyte = 1; coding.dst_multibyte = 0; diff --git a/src/w32.c b/src/w32.c index b789bb47e52..7a31e78d1da 100644 --- a/src/w32.c +++ b/src/w32.c @@ -3581,8 +3581,8 @@ check_windows_init_file () if (fd < 0) { Lisp_Object load_path_print = Fprin1_to_string (full_load_path, Qnil); - char *init_file_name = XSTRING (init_file)->data; - char *load_path = XSTRING (load_path_print)->data; + char *init_file_name = SDATA (init_file); + char *load_path = SDATA (load_path_print); char *buffer = alloca (1024); sprintf (buffer, diff --git a/src/w32fns.c b/src/w32fns.c index 88d30931d51..ea865a7a0ae 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -571,7 +571,7 @@ x_create_bitmap_from_file (f, file) { if (dpyinfo->bitmaps[id].refcount && dpyinfo->bitmaps[id].file - && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) + && !strcmp (dpyinfo->bitmaps[id].file, (char *) SDATA (file))) { ++dpyinfo->bitmaps[id].refcount; return id + 1; @@ -584,7 +584,7 @@ x_create_bitmap_from_file (f, file) return -1; emacs_close (fd); - filename = (char *) XSTRING (found)->data; + filename = (char *) SDATA (found); hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE); @@ -600,11 +600,11 @@ x_create_bitmap_from_file (f, file) id = x_allocate_bitmap_record (f); dpyinfo->bitmaps[id - 1].pixmap = bitmap; dpyinfo->bitmaps[id - 1].refcount = 1; - dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1); + dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SCHARS (file) + 1); dpyinfo->bitmaps[id - 1].depth = 1; dpyinfo->bitmaps[id - 1].height = height; dpyinfo->bitmaps[id - 1].width = width; - strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); + strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file)); return id; #endif /* TODO */ @@ -1216,7 +1216,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) CHECK_STRING (filename); abspath = Fexpand_file_name (filename, Qnil); - fp = fopen (XSTRING (filename)->data, "rt"); + fp = fopen (SDATA (filename), "rt"); if (fp) { char buf[512]; @@ -1556,7 +1556,7 @@ w32_color_map_lookup (colorname) tem = Fcar (elt); - if (lstrcmpi (XSTRING (tem)->data, colorname) == 0) + if (lstrcmpi (SDATA (tem), colorname) == 0) { ret = XUINT (Fcdr (elt)); break; @@ -1986,9 +1986,9 @@ x_decode_color (f, arg, def) CHECK_STRING (arg); - if (strcmp (XSTRING (arg)->data, "black") == 0) + if (strcmp (SDATA (arg), "black") == 0) return BLACK_PIX_DEFAULT (f); - else if (strcmp (XSTRING (arg)->data, "white") == 0) + else if (strcmp (SDATA (arg), "white") == 0) return WHITE_PIX_DEFAULT (f); if ((FRAME_W32_DISPLAY_INFO (f)->n_planes * FRAME_W32_DISPLAY_INFO (f)->n_cbits) == 1) @@ -1996,7 +1996,7 @@ x_decode_color (f, arg, def) /* w32_defined_color is responsible for coping with failures by looking for a near-miss. */ - if (w32_defined_color (f, XSTRING (arg)->data, &cdef, 1)) + if (w32_defined_color (f, SDATA (arg), &cdef, 1)) return cdef.pixel; /* defined_color failed; return an ultimate default. */ @@ -2476,11 +2476,11 @@ x_set_icon_name (f, arg, oldval) BLOCK_INPUT; result = x_text_icon (f, - (char *) XSTRING ((!NILP (f->icon_name) - ? f->icon_name - : !NILP (f->title) - ? f->title - : f->name))->data); + (char *) SDATA ((!NILP (f->icon_name) + ? f->icon_name + : !NILP (f->title) + ? f->title + : f->name))); if (result) { @@ -2522,12 +2522,12 @@ x_set_font (f, arg, oldval) BLOCK_INPUT; result = (STRINGP (fontset_name) - ? x_new_fontset (f, XSTRING (fontset_name)->data) - : x_new_font (f, XSTRING (arg)->data)); + ? x_new_fontset (f, SDATA (fontset_name)) + : x_new_font (f, SDATA (arg))); UNBLOCK_INPUT; if (EQ (result, Qnil)) - error ("Font `%s' is not defined", XSTRING (arg)->data); + error ("Font `%s' is not defined", SDATA (arg)); else if (EQ (result, Qt)) error ("The characters of the given font have varying widths"); else if (STRINGP (result)) @@ -2812,7 +2812,7 @@ x_set_name (f, name, explicit) /* Check for no change needed in this very common case before we do any consing. */ if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name, - XSTRING (f->name)->data)) + SDATA (f->name))) return; name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name); } @@ -2836,7 +2836,7 @@ x_set_name (f, name, explicit) name = ENCODE_SYSTEM (name); BLOCK_INPUT; - SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); + SetWindowText(FRAME_W32_WINDOW (f), SDATA (name)); UNBLOCK_INPUT; } } @@ -2896,7 +2896,7 @@ x_set_title (f, name, old_name) name = ENCODE_SYSTEM (name); BLOCK_INPUT; - SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); + SetWindowText(FRAME_W32_WINDOW (f), SDATA (name)); UNBLOCK_INPUT; } } @@ -3002,10 +3002,10 @@ validate_x_resource_name () if (STRINGP (Vx_resource_name)) { - unsigned char *p = XSTRING (Vx_resource_name)->data; + unsigned char *p = SDATA (Vx_resource_name); int i; - len = STRING_BYTES (XSTRING (Vx_resource_name)); + len = SBYTES (Vx_resource_name); /* Only letters, digits, - and _ are valid in resource names. Count the valid characters and count the invalid ones. */ @@ -3044,12 +3044,12 @@ validate_x_resource_name () for (i = 0; i < len; i++) { - int c = XSTRING (new)->data[i]; + int c = SREF (new, i); if (! ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '_')) - XSTRING (new)->data[i] = '_'; + SREF (new, i) = '_'; } } @@ -3087,37 +3087,37 @@ and the class is `Emacs.CLASS.SUBCLASS'. */) /* Allocate space for the components, the dots which separate them, and the final '\0'. Make them big enough for the worst case. */ - name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name)) + name_key = (char *) alloca (SBYTES (Vx_resource_name) + (STRINGP (component) - ? STRING_BYTES (XSTRING (component)) : 0) - + STRING_BYTES (XSTRING (attribute)) + ? SBYTES (component) : 0) + + SBYTES (attribute) + 3); class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) - + STRING_BYTES (XSTRING (class)) + + SBYTES (class) + (STRINGP (subclass) - ? STRING_BYTES (XSTRING (subclass)) : 0) + ? SBYTES (subclass) : 0) + 3); /* Start with emacs.FRAMENAME for the name (the specific one) and with `Emacs' for the class key (the general one). */ - strcpy (name_key, XSTRING (Vx_resource_name)->data); + strcpy (name_key, SDATA (Vx_resource_name)); strcpy (class_key, EMACS_CLASS); strcat (class_key, "."); - strcat (class_key, XSTRING (class)->data); + strcat (class_key, SDATA (class)); if (!NILP (component)) { strcat (class_key, "."); - strcat (class_key, XSTRING (subclass)->data); + strcat (class_key, SDATA (subclass)); strcat (name_key, "."); - strcat (name_key, XSTRING (component)->data); + strcat (name_key, SDATA (component)); } strcat (name_key, "."); - strcat (name_key, XSTRING (attribute)->data); + strcat (name_key, SDATA (attribute)); value = x_get_string_resource (Qnil, name_key, class_key); @@ -3140,13 +3140,13 @@ x_get_resource_string (attribute, class) /* Allocate space for the components, the dots which separate them, and the final '\0'. */ - name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name)) + name_key = (char *) alloca (SBYTES (Vinvocation_name) + strlen (attribute) + 2); class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) + strlen (class) + 2); sprintf (name_key, "%s.%s", - XSTRING (Vinvocation_name)->data, + SDATA (Vinvocation_name), attribute); sprintf (class_key, "%s.%s", EMACS_CLASS, class); @@ -3201,15 +3201,15 @@ w32_get_arg (alist, param, attribute, class, type) switch (type) { case RES_TYPE_NUMBER: - return make_number (atoi (XSTRING (tem)->data)); + return make_number (atoi (SDATA (tem))); case RES_TYPE_FLOAT: - return make_float (atof (XSTRING (tem)->data)); + return make_float (atof (SDATA (tem))); case RES_TYPE_BOOLEAN: tem = Fdowncase (tem); - if (!strcmp (XSTRING (tem)->data, "on") - || !strcmp (XSTRING (tem)->data, "true")) + if (!strcmp (SDATA (tem), "on") + || !strcmp (SDATA (tem), "true")) return Qt; else return Qnil; @@ -3223,11 +3223,11 @@ w32_get_arg (alist, param, attribute, class, type) { Lisp_Object lower; lower = Fdowncase (tem); - if (!strcmp (XSTRING (lower)->data, "on") - || !strcmp (XSTRING (lower)->data, "true")) + if (!strcmp (SDATA (lower), "on") + || !strcmp (SDATA (lower), "true")) return Qt; - else if (!strcmp (XSTRING (lower)->data, "off") - || !strcmp (XSTRING (lower)->data, "false")) + else if (!strcmp (SDATA (lower), "off") + || !strcmp (SDATA (lower), "false")) return Qnil; else return Fintern (tem, Qnil); @@ -3284,7 +3284,7 @@ or a list (- N) meaning -N pixels relative to bottom/right corner. */) CHECK_STRING (string); - geometry = XParseGeometry ((char *) XSTRING (string)->data, + geometry = XParseGeometry ((char *) SDATA (string), &x, &y, &width, &height); result = Qnil; @@ -5342,7 +5342,7 @@ w32_window (f, window_prompting, minibuffer_only) Elsewhere we specify the window name for the window manager. */ { - char *str = (char *) XSTRING (Vx_resource_name)->data; + char *str = (char *) SDATA (Vx_resource_name); f->namebuf = (char *) xmalloc (strlen (str) + 1); strcpy (f->namebuf, str); } @@ -5409,9 +5409,9 @@ x_icon (f, parms) ? IconicState : NormalState)); - x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name) + x_text_icon (f, (char *) SDATA ((!NILP (f->icon_name) ? f->icon_name - : f->name))->data); + : f->name))); #endif UNBLOCK_INPUT; @@ -5621,9 +5621,9 @@ This function is an internal primitive--use `make-frame' instead. */) { tem = Fquery_fontset (font, Qnil); if (STRINGP (tem)) - font = x_new_fontset (f, XSTRING (tem)->data); + font = x_new_fontset (f, SDATA (tem)); else - font = x_new_font (f, XSTRING (font)->data); + font = x_new_font (f, SDATA (font)); } /* Try out a font which we hope has bold and italic variations. */ if (!STRINGP (font)) @@ -5912,12 +5912,12 @@ w32_load_system_font (f,fontname,size) for (tail = font_names; CONSP (tail); tail = XCDR (tail)) if (dpyinfo->font_table[i].name && (!strcmp (dpyinfo->font_table[i].name, - XSTRING (XCAR (tail))->data) + SDATA (XCAR (tail))) || !strcmp (dpyinfo->font_table[i].full_name, - XSTRING (XCAR (tail))->data))) + SDATA (XCAR (tail))))) return (dpyinfo->font_table + i); - fontname = (char *) XSTRING (XCAR (font_names))->data; + fontname = (char *) SDATA (XCAR (font_names)); } else if (w32_strict_fontnames) { @@ -6125,9 +6125,9 @@ int size; char *bdf_name, *bdf_file; Lisp_Object bdf_pair; - bdf_name = XSTRING (XCAR (bdf_fonts))->data; + bdf_name = SDATA (XCAR (bdf_fonts)); bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist); - bdf_file = XSTRING (XCDR (bdf_pair))->data; + bdf_file = SDATA (XCDR (bdf_pair)); retval = w32_load_bdf_font (f, bdf_name, size, bdf_file); @@ -6413,7 +6413,7 @@ w32_to_x_charset (fncharset) || !SYMBOLP (XCAR (XCDR (this_entry)))) continue; - x_charset = XSTRING (XCAR (this_entry))->data; + x_charset = SDATA (XCAR (this_entry)); w32_charset = XCAR (XCDR (this_entry)); codepage = XCDR (XCDR (this_entry)); @@ -7196,7 +7196,7 @@ enum_font_cb2 (lplf, lptm, FontType, lpef) if (!NILP (lpef->pattern)) { - charset = xlfd_charset_of_font (XSTRING(lpef->pattern)->data); + charset = xlfd_charset_of_font (SDATA (lpef->pattern)); /* We already checked charsets above, but DEFAULT_CHARSET slipped through. So only allow exact matches for DEFAULT_CHARSET. */ @@ -7216,7 +7216,7 @@ enum_font_cb2 (lplf, lptm, FontType, lpef) for ( ; CONSP (charset_list); charset_list = Fcdr (charset_list)) { Lisp_Object this_charset = Fcar (charset_list); - charset = XSTRING (this_charset)->data; + charset = SDATA (this_charset); /* List bold and italic variations if w32-enable-synthesized-fonts is non-nil and this is a plain font. */ @@ -7261,7 +7261,7 @@ enum_font_maybe_add_to_list (lpef, logfont, match_charset, width) return; if (NILP (lpef->pattern) - || w32_font_match (buf, XSTRING (lpef->pattern)->data)) + || w32_font_match (buf, SDATA (lpef->pattern))) { /* Check if we already listed this font. This may happen if w32_enable_synthesized_fonts is non-nil, and there are real @@ -7335,15 +7335,15 @@ static Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names) int n_fonts = 0; list = Vw32_bdf_filename_alist; - ptnstr = XSTRING (pattern)->data; + ptnstr = SDATA (pattern); for ( ; CONSP (list); list = XCDR (list)) { tem = XCAR (list); if (CONSP (tem)) - fontname = XSTRING (XCAR (tem))->data; + fontname = SDATA (XCAR (tem)); else if (STRINGP (tem)) - fontname = XSTRING (tem)->data; + fontname = SDATA (tem); else continue; @@ -7395,7 +7395,7 @@ w32_list_fonts (f, pattern, size, maxnames) /* Avoid expensive EnumFontFamilies functions if we are not going to be able to output one of these anyway. */ - codepage = w32_codepage_for_font (XSTRING (tpat)->data); + codepage = w32_codepage_for_font (SDATA (tpat)); if (codepage != CP_8BIT && codepage != CP_UNICODE && codepage != CP_DEFAULT && codepage != CP_UNKNOWN && !IsValidCodePage(codepage)) @@ -7422,7 +7422,7 @@ w32_list_fonts (f, pattern, size, maxnames) /* Use EnumFontFamiliesEx where it is available, as it knows about character sets. Fall back to EnumFontFamilies for older versions of NT that don't support the 'Ex function. */ - x_to_w32_font (XSTRING (tpat)->data, &ef.logfont); + x_to_w32_font (SDATA (tpat), &ef.logfont); { LOGFONT font_match_pattern; HMODULE gdi32 = GetModuleHandle ("gdi32.dll"); @@ -7492,7 +7492,7 @@ w32_list_fonts (f, pattern, size, maxnames) HDC hdc; HANDLE oldobj; - if (!x_to_w32_font (XSTRING (XCAR (tem))->data, &lf)) + if (!x_to_w32_font (SDATA (XCAR (tem)), &lf)) continue; BLOCK_INPUT; @@ -7639,7 +7639,7 @@ w32_find_bdf_fonts_in_dir (Lisp_Object directory) for ( ; CONSP(filelist); filelist = XCDR (filelist)) { Lisp_Object filename = XCAR (filelist); - if (w32_BDF_to_x_font (XSTRING (filename)->data, fontname, 100)) + if (w32_BDF_to_x_font (SDATA (filename), fontname, 100)) store_in_alist (&list, build_string (fontname), filename); } return list; @@ -7684,7 +7684,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, CHECK_STRING (color); - if (w32_defined_color (f, XSTRING (color)->data, &foo, 0)) + if (w32_defined_color (f, SDATA (color), &foo, 0)) return Qt; else return Qnil; @@ -7700,7 +7700,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, CHECK_STRING (color); - if (w32_defined_color (f, XSTRING (color)->data, &foo, 0)) + if (w32_defined_color (f, SDATA (color), &foo, 0)) { Lisp_Object rgb[3]; @@ -8031,10 +8031,10 @@ x_display_info_for_name (name) validate_x_resource_name (); dpyinfo = w32_term_init (name, (unsigned char *)0, - (char *) XSTRING (Vx_resource_name)->data); + (char *) SDATA (Vx_resource_name)); if (dpyinfo == 0) - error ("Cannot connect to server %s", XSTRING (name)->data); + error ("Cannot connect to server %s", SDATA (name)); w32_in_use = 1; XSETFASTINT (Vwindow_system_version, 3); @@ -8089,7 +8089,7 @@ terminate Emacs if we can't open the connection. */) Vw32_color_map = Fw32_default_color_map (); if (! NILP (xrm_string)) - xrm_option = (unsigned char *) XSTRING (xrm_string)->data; + xrm_option = (unsigned char *) SDATA (xrm_string); else xrm_option = (unsigned char *) 0; @@ -8098,7 +8098,7 @@ terminate Emacs if we can't open the connection. */) { char basename[ MAX_PATH ], *str; - strcpy (basename, XSTRING (Vinvocation_name)->data); + strcpy (basename, SDATA (Vinvocation_name)); str = strrchr (basename, '.'); if (str) *str = 0; Vinvocation_name = build_string (basename); @@ -8110,15 +8110,15 @@ terminate Emacs if we can't open the connection. */) /* This is what opens the connection and sets x_current_display. This also initializes many symbols, such as those used for input. */ dpyinfo = w32_term_init (display, xrm_option, - (char *) XSTRING (Vx_resource_name)->data); + (char *) SDATA (Vx_resource_name)); if (dpyinfo == 0) { if (!NILP (must_succeed)) fatal ("Cannot connect to server %s.\n", - XSTRING (display)->data); + SDATA (display)); else - error ("Cannot connect to server %s", XSTRING (display)->data); + error ("Cannot connect to server %s", SDATA (display)); } w32_in_use = 1; @@ -8402,7 +8402,7 @@ parse_image_spec (spec, keywords, nkeywords, type) /* Find key in KEYWORDS. Error if not found. */ for (i = 0; i < nkeywords; ++i) - if (strcmp (keywords[i].name, XSTRING (SYMBOL_NAME (key))->data) == 0) + if (strcmp (keywords[i].name, SDATA (SYMBOL_NAME (key))) == 0) break; if (i == nkeywords) @@ -8916,7 +8916,7 @@ x_alloc_image_color (f, img, color_name, dflt) xassert (STRINGP (color_name)); - if (w32_defined_color (f, XSTRING (color_name)->data, &color, 1)) + if (w32_defined_color (f, SDATA (color_name), &color, 1)) { /* This isn't called frequently so we get away with simply reallocating the color vector to the needed size, here. */ @@ -9694,7 +9694,7 @@ xbm_image_p (object) if (STRINGP (elt)) { - if (XSTRING (elt)->size + if (SCHARS (elt) < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR) return 0; } @@ -9709,7 +9709,7 @@ xbm_image_p (object) } else if (STRINGP (data)) { - if (XSTRING (data)->size + if (SCHARS (data) < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height) return 0; } @@ -10073,9 +10073,9 @@ xbm_file_p (data) { int w, h; return (STRINGP (data) - && xbm_read_bitmap_data (XSTRING (data)->data, - (XSTRING (data)->data - + STRING_BYTES (XSTRING (data))), + && xbm_read_bitmap_data (SDATA (data), + (SDATA (data) + + SBYTES (data)), &w, &h, NULL)); } @@ -10111,7 +10111,7 @@ xbm_load (f, img) return 0; } - contents = slurp_file (XSTRING (file)->data, &size); + contents = slurp_file (SDATA (file), &size); if (contents == NULL) { image_error ("Error loading XBM image `%s'", img->spec, Qnil); @@ -10161,9 +10161,9 @@ xbm_load (f, img) background); if (in_memory_file_p) - success_p = xbm_load_image (f, img, XSTRING (data)->data, - (XSTRING (data)->data - + STRING_BYTES (XSTRING (data)))); + success_p = xbm_load_image (f, img, SDATA (data), + (SDATA (data) + + SBYTES (data))); else { if (VECTORP (data)) @@ -10177,13 +10177,13 @@ xbm_load (f, img) { Lisp_Object line = XVECTOR (data)->contents[i]; if (STRINGP (line)) - bcopy (XSTRING (line)->data, p, nbytes); + bcopy (SDATA (line), p, nbytes); else bcopy (XBOOL_VECTOR (line)->data, p, nbytes); } } else if (STRINGP (data)) - bits = XSTRING (data)->data; + bits = SDATA (data); else bits = XBOOL_VECTOR (data)->data; @@ -10372,10 +10372,10 @@ xpm_load (f, img) { Lisp_Object name = XCAR (XCAR (tail)); Lisp_Object color = XCDR (XCAR (tail)); - xpm_syms[i].name = (char *) alloca (XSTRING (name)->size + 1); - strcpy (xpm_syms[i].name, XSTRING (name)->data); - xpm_syms[i].value = (char *) alloca (XSTRING (color)->size + 1); - strcpy (xpm_syms[i].value, XSTRING (color)->data); + xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1); + strcpy (xpm_syms[i].name, SDATA (name)); + xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); + strcpy (xpm_syms[i].value, SDATA (color)); } } @@ -10394,14 +10394,14 @@ xpm_load (f, img) } rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f), - XSTRING (file)->data, &img->pixmap, &img->mask, + SDATA (file), &img->pixmap, &img->mask, &attrs); } else { Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL); rc = XpmCreatePixmapFromBuffer (NULL, FRAME_W32_WINDOW (f), - XSTRING (buffer)->data, + SDATA (buffer), &img->pixmap, &img->mask, &attrs); } @@ -11218,8 +11218,8 @@ pbm_read_file (file, size) char *buf = NULL; struct stat st; - if (stat (XSTRING (file)->data, &st) == 0 - && (fp = fopen (XSTRING (file)->data, "r")) != NULL + if (stat (SDATA (file), &st) == 0 + && (fp = fopen (SDATA (file), "r")) != NULL && (buf = (char *) xmalloc (st.st_size), fread (buf, 1, st.st_size, fp) == st.st_size)) { @@ -11272,7 +11272,7 @@ pbm_load (f, img) return 0; } - contents = slurp_file (XSTRING (file)->data, &size); + contents = slurp_file (SDATA (file), &size); if (contents == NULL) { image_error ("Error reading `%s'", file, Qnil); @@ -11287,8 +11287,8 @@ pbm_load (f, img) { Lisp_Object data; data = image_spec_value (img->spec, QCdata, NULL); - p = XSTRING (data)->data; - end = p + STRING_BYTES (XSTRING (data)); + p = SDATA (data); + end = p + SBYTES (data); } /* Check magic number. */ @@ -11644,7 +11644,7 @@ png_load (f, img) } /* Open the image file. */ - fp = fopen (XSTRING (file)->data, "rb"); + fp = fopen (SDATA (file), "rb"); if (!fp) { image_error ("Cannot open image file `%s'", file, Qnil); @@ -11666,8 +11666,8 @@ png_load (f, img) else { /* Read from memory. */ - tbr.bytes = XSTRING (specified_data)->data; - tbr.len = STRING_BYTES (XSTRING (specified_data)); + tbr.bytes = SDATA (specified_data); + tbr.len = SBYTES (specified_data); tbr.index = 0; /* Check PNG signature. */ @@ -11793,7 +11793,7 @@ png_load (f, img) /* The user specified `:background', use that. */ { COLORREF color; - if (w32_defined_color (f, XSTRING (specified_bg)->data, &color, 0)) + if (w32_defined_color (f, SDATA (specified_bg), &color, 0)) { png_color_16 user_bg; @@ -12213,7 +12213,7 @@ jpeg_load (f, img) return 0; } - fp = fopen (XSTRING (file)->data, "r"); + fp = fopen (SDATA (file), "r"); if (fp == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -12260,8 +12260,8 @@ jpeg_load (f, img) if (NILP (specified_data)) jpeg_stdio_src (&cinfo, fp); else - jpeg_memory_src (&cinfo, XSTRING (specified_data)->data, - STRING_BYTES (XSTRING (specified_data))); + jpeg_memory_src (&cinfo, SDATA (specified_data), + SBYTES (specified_data)); jpeg_read_header (&cinfo, TRUE); @@ -12604,7 +12604,7 @@ tiff_load (f, img) } /* Try to open the image file. */ - tiff = TIFFOpen (XSTRING (file)->data, "r"); + tiff = TIFFOpen (SDATA (file), "r"); if (tiff == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -12615,8 +12615,8 @@ tiff_load (f, img) else { /* Memory source! */ - memsrc.bytes = XSTRING (specified_data)->data; - memsrc.len = STRING_BYTES (XSTRING (specified_data)); + memsrc.bytes = SDATA (specified_data); + memsrc.len = SBYTES (specified_data); memsrc.index = 0; tiff = TIFFClientOpen ("memory_source", "r", &memsrc, @@ -12852,7 +12852,7 @@ gif_load (f, img) } /* Open the GIF file. */ - gif = DGifOpenFileName (XSTRING (file)->data); + gif = DGifOpenFileName (SDATA (file)); if (gif == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -12864,8 +12864,8 @@ gif_load (f, img) { /* Read from memory! */ current_gif_memory_src = &memsrc; - memsrc.bytes = XSTRING (specified_data)->data; - memsrc.len = STRING_BYTES (XSTRING (specified_data)); + memsrc.bytes = SDATA (specified_data); + memsrc.len = SBYTES (specified_data); memsrc.index = 0; gif = DGifOpen(&memsrc, gif_read_from_memory); @@ -13323,10 +13323,10 @@ selected frame. Value is VALUE. */) CHECK_STRING (value); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom, XA_STRING, 8, PropModeReplace, - XSTRING (value)->data, XSTRING (value)->size); + SDATA (value), SCHARS (value)); /* Make sure the property is set when we return. */ XFlush (FRAME_W32_DISPLAY (f)); @@ -13352,7 +13352,7 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) CHECK_STRING (prop); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom); /* Make sure the property is removed when we return. */ @@ -13386,7 +13386,7 @@ value. */) CHECK_STRING (prop); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom, 0, 0, False, XA_STRING, &actual_type, &actual_format, &actual_size, @@ -13753,9 +13753,9 @@ x_create_tip_frame (dpyinfo, parms, text) { tem = Fquery_fontset (font, Qnil); if (STRINGP (tem)) - font = x_new_fontset (f, XSTRING (tem)->data); + font = x_new_fontset (f, SDATA (tem)); else - font = x_new_font (f, XSTRING (font)->data); + font = x_new_font (f, SDATA (font)); } /* Try out a font which we hope has bold and italic variations. */ @@ -14313,14 +14313,14 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) /* Create the dialog with PROMPT as title, using DIR as initial directory and using "*" as pattern. */ dir = Fexpand_file_name (dir, Qnil); - strncpy (init_dir, XSTRING (dir)->data, MAX_PATH); + strncpy (init_dir, SDATA (dir), MAX_PATH); init_dir[MAX_PATH] = '\0'; unixtodos_filename (init_dir); if (STRINGP (default_filename)) { char *file_name_only; - char *full_path_name = XSTRING (default_filename)->data; + char *full_path_name = SDATA (default_filename); unixtodos_filename (full_path_name); @@ -14354,7 +14354,7 @@ specified. Ensure that file exists if MUSTMATCH is non-nil. */) file_details.lpstrFile = filename; file_details.nMaxFile = sizeof (filename); file_details.lpstrInitialDir = init_dir; - file_details.lpstrTitle = XSTRING (prompt)->data; + file_details.lpstrTitle = SDATA (prompt); file_details.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_ENABLEHOOK); if (!NILP (mustmatch)) @@ -14507,11 +14507,11 @@ otherwise it is an integer representing a ShowWindow flag: document = ENCODE_FILE (document); if ((int) ShellExecute (NULL, (STRINGP (operation) ? - XSTRING (operation)->data : NULL), - XSTRING (document)->data, + SDATA (operation) : NULL), + SDATA (document), (STRINGP (parameters) ? - XSTRING (parameters)->data : NULL), - XSTRING (current_dir)->data, + SDATA (parameters) : NULL), + SDATA (current_dir), (INTEGERP (show_flag) ? XINT (show_flag) : SW_SHOWDEFAULT)) > 32) @@ -14573,7 +14573,7 @@ w32_parse_hot_key (key) c = Fcar (c); if (!SYMBOLP (c)) abort (); - vk_code = lookup_vk_code (XSTRING (SYMBOL_NAME (c))->data); + vk_code = lookup_vk_code (SDATA (SYMBOL_NAME (c))); } else if (INTEGERP (c)) { @@ -14777,7 +14777,7 @@ If the underlying system call fails, value is nil. */) /* On Windows, we may need to specify the root directory of the volume holding FILENAME. */ char rootname[MAX_PATH]; - char *name = XSTRING (encoded)->data; + char *name = SDATA (encoded); /* find the root name of the volume if given */ if (isalpha (name[0]) && name[1] == ':') diff --git a/src/w32menu.c b/src/w32menu.c index c27ad031103..1816e33875b 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -518,7 +518,7 @@ single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth) enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; - if (!NILP (map) && XSTRING (item_string)->data[0] == '@') + if (!NILP (map) && SREF (item_string, 0) == '@') { if (!NILP (enabled)) /* An enabled separate pane. Remember this to handle it later. */ @@ -1201,7 +1201,7 @@ single_submenu (item_key, item_name, maps) } #endif pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); /* If there is just one top-level pane, put all its items directly under the top-level menu. */ if (menu_items_n_panes == 1) @@ -1265,9 +1265,9 @@ single_submenu (item_key, item_name, maps) else save_wv->contents = wv; - wv->name = (char *) XSTRING (item_name)->data; + wv->name = (char *) SDATA (item_name); if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; + wv->key = (char *) SDATA (descrip); wv->value = 0; /* The EMACS_INT cast avoids a warning. There's no problem as long as pointers have enough bits to hold small integers. */ @@ -1448,7 +1448,7 @@ set_frame_menubar (f, first_time, deep_p) string = XVECTOR (items)->contents[i + 1]; if (NILP (string)) break; - wv->name = (char *) XSTRING (string)->data; + wv->name = (char *) SDATA (string); wv = wv->next; } @@ -1471,7 +1471,7 @@ set_frame_menubar (f, first_time, deep_p) break; wv = xmalloc_widget_value (); - wv->name = (char *) XSTRING (string)->data; + wv->name = (char *) SDATA (string); wv->value = 0; wv->enabled = 1; wv->button_type = BUTTON_TYPE_NONE; @@ -1662,7 +1662,7 @@ w32_menu_show (f, x, y, for_click, keymaps, title, error) } #endif pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); /* If there is just one top-level pane, put all its items directly under the top-level menu. */ if (menu_items_n_panes == 1) @@ -1727,9 +1727,9 @@ w32_menu_show (f, x, y, for_click, keymaps, title, error) prev_wv->next = wv; else save_wv->contents = wv; - wv->name = (char *) XSTRING (item_name)->data; + wv->name = (char *) SDATA (item_name); if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; + wv->key = (char *) SDATA (descrip); wv->value = 0; /* Use the contents index as call_data, since we are restricted to 16-bits. */ @@ -1773,7 +1773,7 @@ w32_menu_show (f, x, y, for_click, keymaps, title, error) if (STRING_MULTIBYTE (title)) title = ENCODE_SYSTEM (title); #endif - wv_title->name = (char *) XSTRING (title)->data; + wv_title->name = (char *) SDATA (title); wv_title->enabled = TRUE; wv_title->title = TRUE; wv_title->button_type = BUTTON_TYPE_NONE; @@ -1906,7 +1906,7 @@ w32_dialog_show (f, keymaps, title, error) pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); prev_wv = xmalloc_widget_value (); prev_wv->value = pane_string; if (keymaps && !NILP (prefix)) @@ -1955,8 +1955,8 @@ w32_dialog_show (f, keymaps, title, error) prev_wv->next = wv; wv->name = (char *) button_names[nb_buttons]; if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; - wv->value = (char *) XSTRING (item_name)->data; + wv->key = (char *) SDATA (descrip); + wv->value = (char *) SDATA (item_name); wv->call_data = (void *) &XVECTOR (menu_items)->contents[i]; wv->enabled = !NILP (enable); wv->help = Qnil; diff --git a/src/w32proc.c b/src/w32proc.c index b94e5cca53c..a44a326caf9 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -760,7 +760,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) } /* make sure argv[0] and cmdname are both in DOS format */ - cmdname = XSTRING (program)->data; + cmdname = SDATA (program); unixtodos_filename (cmdname); argv[0] = cmdname; @@ -784,7 +784,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) strcpy (cmdname, egetenv ("CMDPROXY")); else { - strcpy (cmdname, XSTRING (Vinvocation_directory)->data); + strcpy (cmdname, SDATA (Vinvocation_directory)); strcat (cmdname, "cmdproxy.exe"); } unixtodos_filename (cmdname); @@ -1723,7 +1723,7 @@ All path elements in FILENAME are converted to their short names. */) filename = Fexpand_file_name (filename, Qnil); /* luckily, this returns the short version of each element in the path. */ - if (GetShortPathName (XSTRING (filename)->data, shortname, MAX_PATH) == 0) + if (GetShortPathName (SDATA (filename), shortname, MAX_PATH) == 0) return Qnil; CORRECT_DIR_SEPS (shortname); @@ -1747,7 +1747,7 @@ All path elements in FILENAME are converted to their long names. */) /* first expand it. */ filename = Fexpand_file_name (filename, Qnil); - if (!w32_get_long_filename (XSTRING (filename)->data, longname, MAX_PATH)) + if (!w32_get_long_filename (SDATA (filename), longname, MAX_PATH)) return Qnil; CORRECT_DIR_SEPS (longname); diff --git a/src/w32select.c b/src/w32select.c index ef0910964e8..1cb5838c6fc 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -125,8 +125,8 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, BLOCK_INPUT; - nbytes = STRING_BYTES (XSTRING (string)) + 1; - src = XSTRING (string)->data; + nbytes = SBYTES (string) + 1; + src = SDATA (string); dst = src; /* We need to know how many lines there are, since we need CRLF line @@ -141,7 +141,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, { /* Since we are now handling multilingual text, we must consider encoding text for the clipboard. */ - int charset_info = find_charset_in_text (src, XSTRING (string)->size, + int charset_info = find_charset_in_text (src, SCHARS (string), nbytes, NULL, Qnil); if (charset_info == 0) @@ -202,8 +202,8 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, && !NILP (Ffboundp (coding.pre_write_conversion))) { string = run_pre_post_conversion_on_str (string, &coding, 1); - src = XSTRING (string)->data; - nbytes = STRING_BYTES (XSTRING (string)); + src = SDATA (string); + nbytes = SBYTES (string); } coding.src_multibyte = 1; coding.dst_multibyte = 0; @@ -368,7 +368,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data, /* Convert CRLF line endings (the standard CF_TEXT clipboard format) to LF endings as used internally by Emacs. */ - dst = XSTRING (ret)->data; + dst = SDATA (ret); while (1) { unsigned char *next; diff --git a/src/w32term.c b/src/w32term.c index f8c3a7bd69b..c9628277a47 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -6508,9 +6508,9 @@ note_mode_line_highlight (w, x, mode_line_p) if (glyph < end && STRINGP (glyph->object) - && XSTRING (glyph->object)->intervals + && STRING_INTERVALS (glyph->object) && glyph->charpos >= 0 - && glyph->charpos < XSTRING (glyph->object)->size) + && glyph->charpos < SCHARS (glyph->object)) { /* If we're on a string with `help-echo' text property, arrange for the help to be displayed. This is done by @@ -6829,7 +6829,7 @@ note_mouse_highlight (f, x, y) if (NILP (b)) b = make_number (0); if (NILP (e)) - e = make_number (XSTRING (object)->size - 1); + e = make_number (SCHARS (object) - 1); fast_find_string_pos (w, XINT (b), object, &dpyinfo->mouse_face_beg_col, &dpyinfo->mouse_face_beg_row, @@ -6927,7 +6927,7 @@ note_mouse_highlight (f, x, y) /* Try text properties. */ if (STRINGP (object) && charpos >= 0 - && charpos < XSTRING (object)->size) + && charpos < SCHARS (object)) { help = Fget_text_property (make_number (charpos), Qhelp_echo, object); @@ -8619,7 +8619,7 @@ w32_read_socket (sd, bufp, numchars, expected) /* We may get paint messages even though the client area is clipped - these are not expose events. */ DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f, - XSTRING (f->name)->data)); + SDATA (f->name))); } else if (f->async_visible != 1) { @@ -8628,7 +8628,7 @@ w32_read_socket (sd, bufp, numchars, expected) f->async_iconified = 0; SET_FRAME_GARBAGED (f); DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f, - XSTRING (f->name)->data)); + SDATA (f->name))); /* WM_PAINT serves as MapNotify as well, so report visibility changes properly. */ @@ -9308,7 +9308,7 @@ w32_read_socket (sd, bufp, numchars, expected) if (!FRAME_OBSCURED_P (f)) { DebPrint (("frame %p (%s) obscured\n", f, - XSTRING (f->name)->data)); + SDATA (f->name))); } } else @@ -9320,7 +9320,7 @@ w32_read_socket (sd, bufp, numchars, expected) { SET_FRAME_GARBAGED (f); DebPrint (("obscured frame %p (%s) found to be visible\n", f, - XSTRING (f->name)->data)); + SDATA (f->name))); /* Force a redisplay sooner or later. */ record_asynch_buffer_change (); @@ -9991,7 +9991,7 @@ x_bitmap_icon (f, icon) if (NILP (icon)) hicon = LoadIcon (hinst, EMACS_CLASS); else if (STRINGP (icon)) - hicon = LoadImage (NULL, (LPCTSTR) XSTRING (icon)->data, IMAGE_ICON, 0, 0, + hicon = LoadImage (NULL, (LPCTSTR) SDATA (icon), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE); else if (SYMBOLP (icon)) { @@ -10121,7 +10121,7 @@ x_new_fontset (f, fontsetname) to do. */ return fontset_name (fontset); - result = x_new_font (f, (XSTRING (fontset_ascii (fontset))->data)); + result = x_new_font (f, (SDATA (fontset_ascii (fontset)))); if (!STRINGP (result)) /* Can't load ASCII font. */ @@ -11047,11 +11047,11 @@ w32_initialize_display_info (display_name) dpyinfo->name_list_element = XCAR (w32_display_name_list); dpyinfo->w32_id_name - = (char *) xmalloc (XSTRING (Vinvocation_name)->size - + XSTRING (Vsystem_name)->size + = (char *) xmalloc (SCHARS (Vinvocation_name) + + SCHARS (Vsystem_name) + 2); sprintf (dpyinfo->w32_id_name, "%s@%s", - XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data); + SDATA (Vinvocation_name), SDATA (Vsystem_name)); /* Default Console mode values - overridden when running in GUI mode with values obtained from system metrics. */ diff --git a/src/window.c b/src/window.c index 0bacf5fd549..333e07b142d 100644 --- a/src/window.c +++ b/src/window.c @@ -2747,7 +2747,7 @@ BUFFER can be a buffer or buffer name. */) { if (!NILP (w->dedicated) && !EQ (tem, buffer)) error ("Window is dedicated to `%s'", - XSTRING (XBUFFER (tem)->name)->data); + SDATA (XBUFFER (tem)->name)); unshow_buffer (w); } diff --git a/src/xdisp.c b/src/xdisp.c index e594ca20c74..d391a37f229 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3698,7 +3698,7 @@ get_overlay_strings (it, charpos) it->stop_charpos = 0; xassert (STRINGP (it->string)); it->end_charpos = SCHARS (it->string); - it->multibyte_p = SMBP (it->string); + it->multibyte_p = STRING_MULTIBYTE (it->string); it->method = next_element_from_string; } else @@ -6102,9 +6102,9 @@ message_with_string (m, string, log) message = Fformat (2, args); if (log) - message3 (message, SBYTES (message), SMBP (message)); + message3 (message, SBYTES (message), STRING_MULTIBYTE (message)); else - message3_nolog (message, SBYTES (message), SMBP (message)); + message3_nolog (message, SBYTES (message), STRING_MULTIBYTE (message)); UNGCPRO; @@ -6824,7 +6824,7 @@ restore_message () xassert (CONSP (Vmessage_stack)); msg = XCAR (Vmessage_stack); if (STRINGP (msg)) - message3_nolog (msg, SBYTES (msg), SMBP (msg)); + message3_nolog (msg, SBYTES (msg), STRING_MULTIBYTE (msg)); else message3_nolog (msg, 0, 0); } diff --git a/src/xfaces.c b/src/xfaces.c index 085a0929751..65ce504d270 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -290,7 +290,7 @@ Boston, MA 02111-1307, USA. */ /* Make a copy of the contents of Lisp string S on the stack using alloca. Value is a pointer to the copy. */ -#define LSTRDUPA(S) STRDUPA (XSTRING ((S))->data) +#define LSTRDUPA(S) STRDUPA (SDATA ((S))) /* Size of hash table of realized faces in face caches (should be a prime number). */ @@ -1146,7 +1146,7 @@ the pixmap. Bits are stored row by row, each row occupies { int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1) / BITS_PER_CHAR); - if (STRING_BYTES (XSTRING (data)) >= bytes_per_row * XINT (height)) + if (SBYTES (data) >= bytes_per_row * XINT (height)) pixmap_p = 1; } } @@ -1190,7 +1190,7 @@ load_pixmap (f, name, w_ptr, h_ptr) h = XINT (Fcar (Fcdr (name))); bits = Fcar (Fcdr (Fcdr (name))); - bitmap_id = x_create_bitmap_from_data (f, XSTRING (bits)->data, + bitmap_id = x_create_bitmap_from_data (f, SDATA (bits), w, h); } else @@ -1569,7 +1569,7 @@ If FRAME is nil or omitted, use the selected frame. */) CHECK_FRAME (frame); CHECK_STRING (color); f = XFRAME (frame); - return face_color_gray_p (f, XSTRING (color)->data) ? Qt : Qnil; + return face_color_gray_p (f, SDATA (color)) ? Qt : Qnil; } @@ -1587,7 +1587,7 @@ COLOR must be a valid color name. */) CHECK_FRAME (frame); CHECK_STRING (color); f = XFRAME (frame); - if (face_color_supported_p (f, XSTRING (color)->data, !NILP (background_p))) + if (face_color_supported_p (f, SDATA (color), !NILP (background_p))) return Qt; return Qnil; } @@ -1621,7 +1621,7 @@ load_color (f, face, name, target_index) /* if the color map is full, defined_color will return a best match to the values in an existing cell. */ - if (!defined_color (f, XSTRING (name)->data, &color, 1)) + if (!defined_color (f, SDATA (name), &color, 1)) { add_to_log ("Unable to load color \"%s\"", name, Qnil); @@ -1701,7 +1701,7 @@ load_face_colors (f, face, attrs) face_color_supported_p is smart enough to know that grays are "supported" as background because we are supposed to use stipple for them. */ - if (!face_color_supported_p (f, XSTRING (bg)->data, 0) + if (!face_color_supported_p (f, SDATA (bg), 0) && !NILP (Fbitmap_spec_p (Vface_default_stipple))) { x_destroy_bitmap (f, face->stipple); @@ -2476,7 +2476,7 @@ x_face_list_fonts (f, pattern, fonts, nfonts, try_alternatives_p) for (tem = lfonts; CONSP (tem) && n < nfonts; tem = XCDR (tem)) { Lisp_Object elt, tail; - char *name = XSTRING (XCAR (tem))->data; + char *name = SDATA (XCAR (tem)); /* Ignore fonts matching a pattern from face-ignored-fonts. */ for (tail = Vface_ignored_fonts; CONSP (tail); tail = XCDR (tail)) @@ -2520,7 +2520,7 @@ x_face_list_fonts (f, pattern, fonts, nfonts, try_alternatives_p) Lisp_Object entry = XCAR (list); if (CONSP (entry) && STRINGP (XCAR (entry)) - && strcmp (XSTRING (XCAR (entry))->data, pattern) == 0) + && strcmp (SDATA (XCAR (entry)), pattern) == 0) break; list = XCDR (list); } @@ -2536,8 +2536,8 @@ x_face_list_fonts (f, pattern, fonts, nfonts, try_alternatives_p) STRINGP (name)) /* Ignore patterns equal to PATTERN because we tried that already with no success. */ - && (strcmp (XSTRING (name)->data, pattern) == 0 - || (n = x_face_list_fonts (f, XSTRING (name)->data, + && (strcmp (SDATA (name), pattern) == 0 + || (n = x_face_list_fonts (f, SDATA (name), fonts, nfonts, 0), n == 0))) patterns = XCDR (patterns); @@ -2647,8 +2647,8 @@ font_list_1 (f, pattern, family, registry, fonts) if (NILP (pattern)) { - family_str = (NILP (family) ? "*" : (char *) XSTRING (family)->data); - registry_str = (NILP (registry) ? "*" : (char *) XSTRING (registry)->data); + family_str = (NILP (family) ? "*" : (char *) SDATA (family)); + registry_str = (NILP (registry) ? "*" : (char *) SDATA (registry)); pattern_str = (char *) alloca (strlen (family_str) + strlen (registry_str) @@ -2666,7 +2666,7 @@ font_list_1 (f, pattern, family, registry, fonts) } } else - pattern_str = (char *) XSTRING (pattern)->data; + pattern_str = (char *) SDATA (pattern); return sorted_font_list (f, pattern_str, cmp_font_names, fonts); } @@ -3087,7 +3087,7 @@ resolve_face_name (face_name) Lisp_Object aliased; if (STRINGP (face_name)) - face_name = intern (XSTRING (face_name)->data); + face_name = intern (SDATA (face_name)); while (SYMBOLP (face_name)) { @@ -3210,13 +3210,13 @@ set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p) int pt; int have_xlfd_p; int fontset; - char *font_name = XSTRING (fontname)->data; + char *font_name = SDATA (fontname); struct font_info *font_info; /* If FONTNAME is actually a fontset name, get ASCII font name of it. */ fontset = fs_query_fontset (fontname, 0); if (fontset >= 0) - font_name = XSTRING (fontset_ascii (fontset))->data; + font_name = SDATA (fontset_ascii (fontset)); /* Check if FONT_NAME is surely available on the system. Usually FONT_NAME is already cached for the frame F and FS_LOAD_FONT @@ -3522,7 +3522,7 @@ merge_face_vector_with_property (f, to, prop) add_to_log ("Invalid face color", color_name, Qnil); } else if (SYMBOLP (first) - && *XSTRING (SYMBOL_NAME (first))->data == ':') + && *SDATA (SYMBOL_NAME (first)) == ':') { /* Assume this is the property list form. */ while (CONSP (prop) && CONSP (XCDR (prop))) @@ -3904,7 +3904,7 @@ FRAME 0 means change the face on all frames, and change the default if (!UNSPECIFIEDP (value)) { CHECK_STRING (value); - if (XSTRING (value)->size == 0) + if (SCHARS (value) == 0) signal_error ("Invalid face family", value); } old_value = LFACE_FAMILY (lface); @@ -3964,7 +3964,7 @@ FRAME 0 means change the face on all frames, and change the default && !EQ (value, Qnil)) /* Underline color. */ || (STRINGP (value) - && XSTRING (value)->size == 0)) + && SCHARS (value) == 0)) signal_error ("Invalid face underline", value); old_value = LFACE_UNDERLINE (lface); @@ -3978,7 +3978,7 @@ FRAME 0 means change the face on all frames, and change the default && !EQ (value, Qnil)) /* Overline color. */ || (STRINGP (value) - && XSTRING (value)->size == 0)) + && SCHARS (value) == 0)) signal_error ("Invalid face overline", value); old_value = LFACE_OVERLINE (lface); @@ -3992,7 +3992,7 @@ FRAME 0 means change the face on all frames, and change the default && !EQ (value, Qnil)) /* Strike-through color. */ || (STRINGP (value) - && XSTRING (value)->size == 0)) + && SCHARS (value) == 0)) signal_error ("Invalid face strike-through", value); old_value = LFACE_STRIKE_THROUGH (lface); @@ -4014,7 +4014,7 @@ FRAME 0 means change the face on all frames, and change the default else if (INTEGERP (value)) valid_p = XINT (value) != 0; else if (STRINGP (value)) - valid_p = XSTRING (value)->size > 0; + valid_p = SCHARS (value) > 0; else if (CONSP (value)) { Lisp_Object tem; @@ -4038,7 +4038,7 @@ FRAME 0 means change the face on all frames, and change the default } else if (EQ (k, QCcolor)) { - if (!STRINGP (v) || XSTRING (v)->size == 0) + if (!STRINGP (v) || SCHARS (v) == 0) break; } else if (EQ (k, QCstyle)) @@ -4081,7 +4081,7 @@ FRAME 0 means change the face on all frames, and change the default on the frame (display) whether the color will be valid when the face is realized. */ CHECK_STRING (value); - if (XSTRING (value)->size == 0) + if (SCHARS (value) == 0) signal_error ("Empty foreground color value", value); } old_value = LFACE_FOREGROUND (lface); @@ -4095,7 +4095,7 @@ FRAME 0 means change the face on all frames, and change the default on the frame (display) whether the color will be valid when the face is realized. */ CHECK_STRING (value); - if (XSTRING (value)->size == 0) + if (SCHARS (value) == 0) signal_error ("Empty background color value", value); } old_value = LFACE_BACKGROUND (lface); @@ -4445,13 +4445,13 @@ face_boolean_x_resource_value (value, signal_p) xassert (STRINGP (value)); - if (xstricmp (XSTRING (value)->data, "on") == 0 - || xstricmp (XSTRING (value)->data, "true") == 0) + if (xstricmp (SDATA (value), "on") == 0 + || xstricmp (SDATA (value), "true") == 0) result = Qt; - else if (xstricmp (XSTRING (value)->data, "off") == 0 - || xstricmp (XSTRING (value)->data, "false") == 0) + else if (xstricmp (SDATA (value), "off") == 0 + || xstricmp (SDATA (value), "false") == 0) result = Qnil; - else if (xstricmp (XSTRING (value)->data, "unspecified") == 0) + else if (xstricmp (SDATA (value), "unspecified") == 0) result = Qunspecified; else if (signal_p) signal_error ("Invalid face attribute value from X resource", value); @@ -4471,7 +4471,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", CHECK_SYMBOL (attr); CHECK_STRING (value); - if (xstricmp (XSTRING (value)->data, "unspecified") == 0) + if (xstricmp (SDATA (value), "unspecified") == 0) value = Qunspecified; else if (EQ (attr, QCheight)) { @@ -4482,7 +4482,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", else if (EQ (attr, QCbold) || EQ (attr, QCitalic)) value = face_boolean_x_resource_value (value, 1); else if (EQ (attr, QCweight) || EQ (attr, QCslant) || EQ (attr, QCwidth)) - value = intern (XSTRING (value)->data); + value = intern (SDATA (value)); else if (EQ (attr, QCreverse_video) || EQ (attr, QCinverse_video)) value = face_boolean_x_resource_value (value, 1); else if (EQ (attr, QCunderline) @@ -4528,7 +4528,7 @@ x_update_menu_appearance (f) char line[512]; Lisp_Object lface = lface_from_face_name (f, Qmenu, 1); struct face *face = FACE_FROM_ID (f, MENU_FACE_ID); - char *myname = XSTRING (Vx_resource_name)->data; + char *myname = SDATA (Vx_resource_name); int changed_p = 0; #ifdef USE_MOTIF const char *popup_path = "popup_menu"; @@ -4540,10 +4540,10 @@ x_update_menu_appearance (f) { sprintf (line, "%s.%s*foreground: %s", myname, popup_path, - XSTRING (LFACE_FOREGROUND (lface))->data); + SDATA (LFACE_FOREGROUND (lface))); XrmPutLineResource (&rdb, line); sprintf (line, "%s.pane.menubar*foreground: %s", - myname, XSTRING (LFACE_FOREGROUND (lface))->data); + myname, SDATA (LFACE_FOREGROUND (lface))); XrmPutLineResource (&rdb, line); changed_p = 1; } @@ -4552,10 +4552,10 @@ x_update_menu_appearance (f) { sprintf (line, "%s.%s*background: %s", myname, popup_path, - XSTRING (LFACE_BACKGROUND (lface))->data); + SDATA (LFACE_BACKGROUND (lface))); XrmPutLineResource (&rdb, line); sprintf (line, "%s.pane.menubar*background: %s", - myname, XSTRING (LFACE_BACKGROUND (lface))->data); + myname, SDATA (LFACE_BACKGROUND (lface))); XrmPutLineResource (&rdb, line); changed_p = 1; } @@ -4837,10 +4837,10 @@ lface_equal_p (v1, v2) switch (XTYPE (a)) { case Lisp_String: - equal_p = ((STRING_BYTES (XSTRING (a)) - == STRING_BYTES (XSTRING (b))) - && bcmp (XSTRING (a)->data, XSTRING (b)->data, - STRING_BYTES (XSTRING (a))) == 0); + equal_p = ((SBYTES (a) + == SBYTES (b)) + && bcmp (SDATA (a), SDATA (b), + SBYTES (a)) == 0); break; case Lisp_Int: @@ -4942,7 +4942,7 @@ hash_string_case_insensitive (string) unsigned char *s; unsigned hash = 0; xassert (STRINGP (string)); - for (s = XSTRING (string)->data; *s; ++s) + for (s = SDATA (string); *s; ++s) hash = (hash << 1) ^ tolower (*s); return hash; } @@ -4975,8 +4975,8 @@ lface_same_font_attributes_p (lface1, lface2) { xassert (lface_fully_specified_p (lface1) && lface_fully_specified_p (lface2)); - return (xstricmp (XSTRING (lface1[LFACE_FAMILY_INDEX])->data, - XSTRING (lface2[LFACE_FAMILY_INDEX])->data) == 0 + return (xstricmp (SDATA (lface1[LFACE_FAMILY_INDEX]), + SDATA (lface2[LFACE_FAMILY_INDEX])) == 0 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX]) && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX]) && EQ (lface1[LFACE_AVGWIDTH_INDEX], lface2[LFACE_AVGWIDTH_INDEX]) @@ -4985,8 +4985,8 @@ lface_same_font_attributes_p (lface1, lface2) && (EQ (lface1[LFACE_FONT_INDEX], lface2[LFACE_FONT_INDEX]) || (STRINGP (lface1[LFACE_FONT_INDEX]) && STRINGP (lface2[LFACE_FONT_INDEX]) - && xstricmp (XSTRING (lface1[LFACE_FONT_INDEX])->data, - XSTRING (lface2[LFACE_FONT_INDEX])->data)))); + && xstricmp (SDATA (lface1[LFACE_FONT_INDEX]), + SDATA (lface2[LFACE_FONT_INDEX]))))); } @@ -5141,11 +5141,11 @@ If FRAME is unspecified or nil, the current frame is used. */) if ((CONSP (color1) && !parse_rgb_list (color1, &cdef1)) || !STRINGP (color1) - || !defined_color (f, XSTRING (color1)->data, &cdef1, 0)) + || !defined_color (f, SDATA (color1), &cdef1, 0)) signal_error ("Invalid color", color1); if ((CONSP (color2) && !parse_rgb_list (color2, &cdef2)) || !STRINGP (color2) - || !defined_color (f, XSTRING (color2)->data, &cdef2, 0)) + || !defined_color (f, SDATA (color2), &cdef2, 0)) signal_error ("Invalid color", color2); return make_number (color_distance (&cdef1, &cdef2)); @@ -6347,7 +6347,7 @@ try_font_list (f, attrs, family, registry, fonts) if the family is -etl-fixed, e.g. The following widens the choices and fixes that problem. */ if (nfonts == 0 && STRINGP (face_family) && STRINGP (registry) - && xstricmp (XSTRING (registry)->data, "mac-roman") == 0) + && xstricmp (SDATA (registry), "mac-roman") == 0) nfonts = try_alternative_families (f, face_family, Qnil, fonts); #endif @@ -6421,7 +6421,7 @@ choose_face_font (f, attrs, fontset, c) /* If what we got is a name pattern, return it. */ if (STRINGP (pattern)) - return xstrdup (XSTRING (pattern)->data); + return xstrdup (SDATA (pattern)); /* Get a list of fonts matching that pattern and choose the best match for the specified face attributes from it. */ @@ -6927,7 +6927,7 @@ map_tty_color (f, face, idx, defaulted) color = face->lface[idx]; if (STRINGP (color) - && XSTRING (color)->size + && SCHARS (color) && CONSP (Vtty_defined_color_alist) && (def = assq_no_quit (color, call1 (Qtty_color_alist, frame)), CONSP (def))) @@ -7277,7 +7277,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg, Limit is the maximum position up to which to check for property changes in Fnext_single_property_change. Strings are usually short, so set the limit to the end of the string. */ - XSETFASTINT (limit, XSTRING (string)->size); + XSETFASTINT (limit, SCHARS (string)); end = Fnext_single_property_change (position, prop_name, string, limit); if (INTEGERP (end)) *endptr = XFASTINT (end); @@ -7345,13 +7345,13 @@ dump_realized_face (face) #endif fprintf (stderr, "foreground: 0x%lx (%s)\n", face->foreground, - XSTRING (face->lface[LFACE_FOREGROUND_INDEX])->data); + SDATA (face->lface[LFACE_FOREGROUND_INDEX])); fprintf (stderr, "background: 0x%lx (%s)\n", face->background, - XSTRING (face->lface[LFACE_BACKGROUND_INDEX])->data); + SDATA (face->lface[LFACE_BACKGROUND_INDEX])); fprintf (stderr, "font_name: %s (%s)\n", face->font_name, - XSTRING (face->lface[LFACE_FAMILY_INDEX])->data); + SDATA (face->lface[LFACE_FAMILY_INDEX])); #ifdef HAVE_X_WINDOWS fprintf (stderr, "font = %p\n", face->font); #endif @@ -7359,7 +7359,7 @@ dump_realized_face (face) fprintf (stderr, "fontset: %d\n", face->fontset); fprintf (stderr, "underline: %d (%s)\n", face->underline_p, - XSTRING (Fsymbol_name (face->lface[LFACE_UNDERLINE_INDEX]))->data); + SDATA (Fsymbol_name (face->lface[LFACE_UNDERLINE_INDEX]))); fprintf (stderr, "hash: %d\n", face->hash); fprintf (stderr, "charset: %d\n", face->charset); } diff --git a/src/xfns.c b/src/xfns.c index 920b3b13a38..2b84c6d0376 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -636,7 +636,7 @@ x_create_bitmap_from_file (f, file) { if (dpyinfo->bitmaps[id].refcount && dpyinfo->bitmaps[id].file - && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) + && !strcmp (dpyinfo->bitmaps[id].file, (char *) SDATA (file))) { ++dpyinfo->bitmaps[id].refcount; return id + 1; @@ -649,7 +649,7 @@ x_create_bitmap_from_file (f, file) return -1; emacs_close (fd); - filename = (char *) XSTRING (found)->data; + filename = (char *) SDATA (found); result = XReadBitmapFile (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), filename, &width, &height, &bitmap, &xhot, &yhot); @@ -660,11 +660,11 @@ x_create_bitmap_from_file (f, file) dpyinfo->bitmaps[id - 1].pixmap = bitmap; dpyinfo->bitmaps[id - 1].refcount = 1; dpyinfo->bitmaps[id - 1].file - = (char *) xmalloc (STRING_BYTES (XSTRING (file)) + 1); + = (char *) xmalloc (SBYTES (file) + 1); dpyinfo->bitmaps[id - 1].depth = 1; dpyinfo->bitmaps[id - 1].height = height; dpyinfo->bitmaps[id - 1].width = width; - strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); + strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file)); return id; } @@ -1385,9 +1385,9 @@ x_decode_color (f, color_name, mono_color) #if 0 /* Don't do this. It's wrong when we're not using the default colormap, it makes freeing difficult, and it's probably not an important optimization. */ - if (strcmp (XSTRING (color_name)->data, "black") == 0) + if (strcmp (SDATA (color_name), "black") == 0) return BLACK_PIX_DEFAULT (f); - else if (strcmp (XSTRING (color_name)->data, "white") == 0) + else if (strcmp (SDATA (color_name), "white") == 0) return WHITE_PIX_DEFAULT (f); #endif @@ -1397,7 +1397,7 @@ x_decode_color (f, color_name, mono_color) /* x_defined_color is responsible for coping with failures by looking for a near-miss. */ - if (x_defined_color (f, XSTRING (color_name)->data, &cdef, 1)) + if (x_defined_color (f, SDATA (color_name), &cdef, 1)) return cdef.pixel; Fsignal (Qerror, Fcons (build_string ("Undefined color"), @@ -1914,9 +1914,9 @@ x_set_icon_type (f, arg, oldval) BLOCK_INPUT; if (NILP (arg)) result = x_text_icon (f, - (char *) XSTRING ((!NILP (f->icon_name) + (char *) SDATA ((!NILP (f->icon_name) ? f->icon_name - : f->name))->data); + : f->name))); else result = x_bitmap_icon (f, arg); @@ -1968,11 +1968,11 @@ x_set_icon_name (f, arg, oldval) BLOCK_INPUT; result = x_text_icon (f, - (char *) XSTRING ((!NILP (f->icon_name) - ? f->icon_name - : !NILP (f->title) - ? f->title - : f->name))->data); + (char *) SDATA ((!NILP (f->icon_name) + ? f->icon_name + : !NILP (f->title) + ? f->title + : f->name))); if (result) { @@ -2000,12 +2000,12 @@ x_set_font (f, arg, oldval) BLOCK_INPUT; result = (STRINGP (fontset_name) - ? x_new_fontset (f, XSTRING (fontset_name)->data) - : x_new_font (f, XSTRING (arg)->data)); + ? x_new_fontset (f, SDATA (fontset_name)) + : x_new_font (f, SDATA (arg))); UNBLOCK_INPUT; if (EQ (result, Qnil)) - error ("Font `%s' is not defined", XSTRING (arg)->data); + error ("Font `%s' is not defined", SDATA (arg)); else if (EQ (result, Qt)) error ("The characters of the given font have varying widths"); else if (STRINGP (result)) @@ -2375,9 +2375,9 @@ x_encode_text (string, coding_system, selectionp, text_bytes, stringp) int *text_bytes, *stringp; int selectionp; { - unsigned char *str = XSTRING (string)->data; - int chars = XSTRING (string)->size; - int bytes = STRING_BYTES (XSTRING (string)); + unsigned char *str = SDATA (string); + int chars = SCHARS (string); + int bytes = SBYTES (string); int charset_info; int bufsize; unsigned char *buf; @@ -2399,9 +2399,9 @@ x_encode_text (string, coding_system, selectionp, text_bytes, stringp) && !NILP (Ffboundp (coding.pre_write_conversion))) { string = run_pre_post_conversion_on_str (string, &coding, 1); - str = XSTRING (string)->data; - chars = XSTRING (string)->size; - bytes = STRING_BYTES (XSTRING (string)); + str = SDATA (string); + chars = SCHARS (string); + bytes = SBYTES (string); } coding.src_multibyte = 1; coding.dst_multibyte = 0; @@ -2458,7 +2458,7 @@ x_set_name (f, name, explicit) /* Check for no change needed in this very common case before we do any consing. */ if (!strcmp (FRAME_X_DISPLAY_INFO (f)->x_id_name, - XSTRING (f->name)->data)) + SDATA (f->name))) return; name = build_string (FRAME_X_DISPLAY_INFO (f)->x_id_name); } @@ -2517,16 +2517,16 @@ x_set_name (f, name, explicit) XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &icon); #endif /* not USE_X_TOOLKIT */ if (!NILP (f->icon_name) - && icon.value != XSTRING (f->icon_name)->data) + && icon.value != SDATA (f->icon_name)) xfree (icon.value); - if (text.value != XSTRING (name)->data) + if (text.value != SDATA (name)) xfree (text.value); } #else /* not HAVE_X11R4 */ XSetIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - XSTRING (name)->data); + SDATA (name)); XStoreName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - XSTRING (name)->data); + SDATA (name)); #endif /* not HAVE_X11R4 */ UNBLOCK_INPUT; } @@ -2624,16 +2624,16 @@ x_set_title (f, name, old_name) XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &icon); #endif /* not USE_X_TOOLKIT */ if (!NILP (f->icon_name) - && icon.value != XSTRING (f->icon_name)->data) + && icon.value != SDATA (f->icon_name)) xfree (icon.value); - if (text.value != XSTRING (name)->data) + if (text.value != SDATA (name)) xfree (text.value); } #else /* not HAVE_X11R4 */ XSetIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - XSTRING (name)->data); + SDATA (name)); XStoreName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - XSTRING (name)->data); + SDATA (name)); #endif /* not HAVE_X11R4 */ UNBLOCK_INPUT; } @@ -2758,10 +2758,10 @@ validate_x_resource_name () if (STRINGP (Vx_resource_name)) { - unsigned char *p = XSTRING (Vx_resource_name)->data; + unsigned char *p = SDATA (Vx_resource_name); int i; - len = STRING_BYTES (XSTRING (Vx_resource_name)); + len = SBYTES (Vx_resource_name); /* Only letters, digits, - and _ are valid in resource names. Count the valid characters and count the invalid ones. */ @@ -2800,12 +2800,12 @@ validate_x_resource_name () for (i = 0; i < len; i++) { - int c = XSTRING (new)->data[i]; + int c = SREF (new, i); if (! ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '_')) - XSTRING (new)->data[i] = '_'; + SREF (new, i) = '_'; } } @@ -2845,37 +2845,37 @@ and the class is `Emacs.CLASS.SUBCLASS'. */) /* Allocate space for the components, the dots which separate them, and the final '\0'. Make them big enough for the worst case. */ - name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name)) + name_key = (char *) alloca (SBYTES (Vx_resource_name) + (STRINGP (component) - ? STRING_BYTES (XSTRING (component)) : 0) - + STRING_BYTES (XSTRING (attribute)) + ? SBYTES (component) : 0) + + SBYTES (attribute) + 3); - class_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_class)) - + STRING_BYTES (XSTRING (class)) + class_key = (char *) alloca (SBYTES (Vx_resource_class) + + SBYTES (class) + (STRINGP (subclass) - ? STRING_BYTES (XSTRING (subclass)) : 0) + ? SBYTES (subclass) : 0) + 3); /* Start with emacs.FRAMENAME for the name (the specific one) and with `Emacs' for the class key (the general one). */ - strcpy (name_key, XSTRING (Vx_resource_name)->data); - strcpy (class_key, XSTRING (Vx_resource_class)->data); + strcpy (name_key, SDATA (Vx_resource_name)); + strcpy (class_key, SDATA (Vx_resource_class)); strcat (class_key, "."); - strcat (class_key, XSTRING (class)->data); + strcat (class_key, SDATA (class)); if (!NILP (component)) { strcat (class_key, "."); - strcat (class_key, XSTRING (subclass)->data); + strcat (class_key, SDATA (subclass)); strcat (name_key, "."); - strcat (name_key, XSTRING (component)->data); + strcat (name_key, SDATA (component)); } strcat (name_key, "."); - strcat (name_key, XSTRING (attribute)->data); + strcat (name_key, SDATA (attribute)); value = x_get_string_resource (check_x_display_info (Qnil)->xrdb, name_key, class_key); @@ -2911,37 +2911,37 @@ display_x_get_resource (dpyinfo, attribute, class, component, subclass) /* Allocate space for the components, the dots which separate them, and the final '\0'. Make them big enough for the worst case. */ - name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name)) + name_key = (char *) alloca (SBYTES (Vx_resource_name) + (STRINGP (component) - ? STRING_BYTES (XSTRING (component)) : 0) - + STRING_BYTES (XSTRING (attribute)) + ? SBYTES (component) : 0) + + SBYTES (attribute) + 3); - class_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_class)) - + STRING_BYTES (XSTRING (class)) + class_key = (char *) alloca (SBYTES (Vx_resource_class) + + SBYTES (class) + (STRINGP (subclass) - ? STRING_BYTES (XSTRING (subclass)) : 0) + ? SBYTES (subclass) : 0) + 3); /* Start with emacs.FRAMENAME for the name (the specific one) and with `Emacs' for the class key (the general one). */ - strcpy (name_key, XSTRING (Vx_resource_name)->data); - strcpy (class_key, XSTRING (Vx_resource_class)->data); + strcpy (name_key, SDATA (Vx_resource_name)); + strcpy (class_key, SDATA (Vx_resource_class)); strcat (class_key, "."); - strcat (class_key, XSTRING (class)->data); + strcat (class_key, SDATA (class)); if (!NILP (component)) { strcat (class_key, "."); - strcat (class_key, XSTRING (subclass)->data); + strcat (class_key, SDATA (subclass)); strcat (name_key, "."); - strcat (name_key, XSTRING (component)->data); + strcat (name_key, SDATA (component)); } strcat (name_key, "."); - strcat (name_key, XSTRING (attribute)->data); + strcat (name_key, SDATA (attribute)); value = x_get_string_resource (dpyinfo->xrdb, name_key, class_key); @@ -2963,13 +2963,13 @@ x_get_resource_string (attribute, class) /* Allocate space for the components, the dots which separate them, and the final '\0'. */ - name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name)) + name_key = (char *) alloca (SBYTES (Vinvocation_name) + strlen (attribute) + 2); class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) + strlen (class) + 2); sprintf (name_key, "%s.%s", - XSTRING (Vinvocation_name)->data, + SDATA (Vinvocation_name), attribute); sprintf (class_key, "%s.%s", EMACS_CLASS, class); @@ -3027,15 +3027,15 @@ x_get_arg (dpyinfo, alist, param, attribute, class, type) switch (type) { case RES_TYPE_NUMBER: - return make_number (atoi (XSTRING (tem)->data)); + return make_number (atoi (SDATA (tem))); case RES_TYPE_FLOAT: - return make_float (atof (XSTRING (tem)->data)); + return make_float (atof (SDATA (tem))); case RES_TYPE_BOOLEAN: tem = Fdowncase (tem); - if (!strcmp (XSTRING (tem)->data, "on") - || !strcmp (XSTRING (tem)->data, "true")) + if (!strcmp (SDATA (tem), "on") + || !strcmp (SDATA (tem), "true")) return Qt; else return Qnil; @@ -3049,11 +3049,11 @@ x_get_arg (dpyinfo, alist, param, attribute, class, type) { Lisp_Object lower; lower = Fdowncase (tem); - if (!strcmp (XSTRING (lower)->data, "on") - || !strcmp (XSTRING (lower)->data, "true")) + if (!strcmp (SDATA (lower), "on") + || !strcmp (SDATA (lower), "true")) return Qt; - else if (!strcmp (XSTRING (lower)->data, "off") - || !strcmp (XSTRING (lower)->data, "false")) + else if (!strcmp (SDATA (lower), "off") + || !strcmp (SDATA (lower), "false")) return Qnil; else return Fintern (tem, Qnil); @@ -3186,7 +3186,7 @@ or a list (- N) meaning -N pixels relative to bottom/right corner. */) CHECK_STRING (string); - geometry = XParseGeometry ((char *) XSTRING (string)->data, + geometry = XParseGeometry ((char *) SDATA (string), &x, &y, &width, &height); #if 0 @@ -3559,7 +3559,7 @@ create_frame_xic (f) { /* Determine the base fontname from the ASCII font name of FONTSET. */ - char *ascii_font = (char *) XSTRING (fontset_ascii (fontset))->data; + char *ascii_font = (char *) SDATA (fontset_ascii (fontset)); char *p = ascii_font; int i; @@ -3780,7 +3780,7 @@ x_window (f, window_prompting, minibuffer_only) Elsewhere we specify the window name for the window manager. */ { - char *str = (char *) XSTRING (Vx_resource_name)->data; + char *str = (char *) SDATA (Vx_resource_name); f->namebuf = (char *) xmalloc (strlen (str) + 1); strcpy (f->namebuf, str); } @@ -3913,8 +3913,8 @@ x_window (f, window_prompting, minibuffer_only) validate_x_resource_name (); - class_hints.res_name = (char *) XSTRING (Vx_resource_name)->data; - class_hints.res_class = (char *) XSTRING (Vx_resource_class)->data; + class_hints.res_name = (char *) SDATA (Vx_resource_name); + class_hints.res_class = (char *) SDATA (Vx_resource_class); XSetClassHint (FRAME_X_DISPLAY (f), XtWindow (shell_widget), &class_hints); #ifdef HAVE_X_I18N @@ -4041,8 +4041,8 @@ x_window (f) validate_x_resource_name (); - class_hints.res_name = (char *) XSTRING (Vx_resource_name)->data; - class_hints.res_class = (char *) XSTRING (Vx_resource_class)->data; + class_hints.res_name = (char *) SDATA (Vx_resource_name); + class_hints.res_class = (char *) SDATA (Vx_resource_class); XSetClassHint (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &class_hints); /* The menubar is part of the ordinary display; @@ -4129,9 +4129,9 @@ x_icon (f, parms) ? IconicState : NormalState)); - x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name) + x_text_icon (f, (char *) SDATA ((!NILP (f->icon_name) ? f->icon_name - : f->name))->data); + : f->name))); UNBLOCK_INPUT; } @@ -4464,9 +4464,9 @@ This function is an internal primitive--use `make-frame' instead. */) { tem = Fquery_fontset (font, Qnil); if (STRINGP (tem)) - font = x_new_fontset (f, XSTRING (tem)->data); + font = x_new_fontset (f, SDATA (tem)); else - font = x_new_font (f, XSTRING (font)->data); + font = x_new_font (f, SDATA (font)); } /* Try out a font which we hope has bold and italic variations. */ @@ -4780,7 +4780,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, CHECK_STRING (color); - if (x_defined_color (f, XSTRING (color)->data, &foo, 0)) + if (x_defined_color (f, SDATA (color), &foo, 0)) return Qt; else return Qnil; @@ -4796,7 +4796,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, CHECK_STRING (color); - if (x_defined_color (f, XSTRING (color)->data, &foo, 0)) + if (x_defined_color (f, SDATA (color), &foo, 0)) { Lisp_Object rgb[3]; @@ -5207,12 +5207,12 @@ select_visual (dpyinfo) /* VALUE should be of the form CLASS-DEPTH, where CLASS is one of `PseudoColor', `TrueColor' etc. and DEPTH is the color depth, a decimal number. NAME is compared with case ignored. */ - char *s = (char *) alloca (STRING_BYTES (XSTRING (value)) + 1); + char *s = (char *) alloca (SBYTES (value) + 1); char *dash; int i, class = -1; XVisualInfo vinfo; - strcpy (s, XSTRING (value)->data); + strcpy (s, SDATA (value)); dash = index (s, '-'); if (dash) { @@ -5236,7 +5236,7 @@ select_visual (dpyinfo) if (class == -1 || !XMatchVisualInfo (dpy, XScreenNumberOfScreen (screen), dpyinfo->n_planes, class, &vinfo)) - fatal ("Invalid visual specification `%s'", XSTRING (value)->data); + fatal ("Invalid visual specification `%s'", SDATA (value)); dpyinfo->visual = vinfo.visual; } @@ -5295,10 +5295,10 @@ x_display_info_for_name (name) validate_x_resource_name (); dpyinfo = x_term_init (name, (char *)0, - (char *) XSTRING (Vx_resource_name)->data); + (char *) SDATA (Vx_resource_name)); if (dpyinfo == 0) - error ("Cannot connect to X server %s", XSTRING (name)->data); + error ("Cannot connect to X server %s", SDATA (name)); x_in_use = 1; XSETFASTINT (Vwindow_system_version, 11); @@ -5328,7 +5328,7 @@ terminate Emacs if we can't open the connection. */) error ("Not using X Windows"); if (! NILP (xrm_string)) - xrm_option = (unsigned char *) XSTRING (xrm_string)->data; + xrm_option = (unsigned char *) SDATA (xrm_string); else xrm_option = (unsigned char *) 0; @@ -5337,7 +5337,7 @@ terminate Emacs if we can't open the connection. */) /* This is what opens the connection and sets x_current_display. This also initializes many symbols, such as those used for input. */ dpyinfo = x_term_init (display, xrm_option, - (char *) XSTRING (Vx_resource_name)->data); + (char *) SDATA (Vx_resource_name)); if (dpyinfo == 0) { @@ -5346,9 +5346,9 @@ terminate Emacs if we can't open the connection. */) Check the DISPLAY environment variable or use `-d'.\n\ Also use the `xhost' program to verify that it is set to permit\n\ connections from your machine.\n", - XSTRING (display)->data); + SDATA (display)); else - error ("Cannot connect to X server %s", XSTRING (display)->data); + error ("Cannot connect to X server %s", SDATA (display)); } x_in_use = 1; @@ -5662,7 +5662,7 @@ parse_image_spec (spec, keywords, nkeywords, type) /* Find key in KEYWORDS. Error if not found. */ for (i = 0; i < nkeywords; ++i) - if (strcmp (keywords[i].name, XSTRING (SYMBOL_NAME (key))->data) == 0) + if (strcmp (keywords[i].name, SDATA (SYMBOL_NAME (key))) == 0) break; if (i == nkeywords) @@ -6142,7 +6142,7 @@ x_alloc_image_color (f, img, color_name, dflt) xassert (STRINGP (color_name)); - if (x_defined_color (f, XSTRING (color_name)->data, &color, 1)) + if (x_defined_color (f, SDATA (color_name), &color, 1)) { /* This isn't called frequently so we get away with simply reallocating the color vector to the needed size, here. */ @@ -6880,7 +6880,7 @@ xbm_image_p (object) if (STRINGP (elt)) { - if (XSTRING (elt)->size + if (SCHARS (elt) < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR) return 0; } @@ -6895,7 +6895,7 @@ xbm_image_p (object) } else if (STRINGP (data)) { - if (XSTRING (data)->size + if (SCHARS (data) < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height) return 0; } @@ -7225,9 +7225,9 @@ xbm_file_p (data) { int w, h; return (STRINGP (data) - && xbm_read_bitmap_data (XSTRING (data)->data, - (XSTRING (data)->data - + STRING_BYTES (XSTRING (data))), + && xbm_read_bitmap_data (SDATA (data), + (SDATA (data) + + SBYTES (data)), &w, &h, NULL)); } @@ -7263,7 +7263,7 @@ xbm_load (f, img) return 0; } - contents = slurp_file (XSTRING (file)->data, &size); + contents = slurp_file (SDATA (file), &size); if (contents == NULL) { image_error ("Error loading XBM image `%s'", img->spec, Qnil); @@ -7313,9 +7313,9 @@ xbm_load (f, img) background); if (in_memory_file_p) - success_p = xbm_load_image (f, img, XSTRING (data)->data, - (XSTRING (data)->data - + STRING_BYTES (XSTRING (data)))); + success_p = xbm_load_image (f, img, SDATA (data), + (SDATA (data) + + SBYTES (data))); else { if (VECTORP (data)) @@ -7329,13 +7329,13 @@ xbm_load (f, img) { Lisp_Object line = XVECTOR (data)->contents[i]; if (STRINGP (line)) - bcopy (XSTRING (line)->data, p, nbytes); + bcopy (SDATA (line), p, nbytes); else bcopy (XBOOL_VECTOR (line)->data, p, nbytes); } } else if (STRINGP (data)) - bits = XSTRING (data)->data; + bits = SDATA (data); else bits = XBOOL_VECTOR (data)->data; @@ -7737,10 +7737,10 @@ xpm_load (f, img) { Lisp_Object name = XCAR (XCAR (tail)); Lisp_Object color = XCDR (XCAR (tail)); - xpm_syms[i].name = (char *) alloca (XSTRING (name)->size + 1); - strcpy (xpm_syms[i].name, XSTRING (name)->data); - xpm_syms[i].value = (char *) alloca (XSTRING (color)->size + 1); - strcpy (xpm_syms[i].value, XSTRING (color)->data); + xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1); + strcpy (xpm_syms[i].name, SDATA (name)); + xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); + strcpy (xpm_syms[i].value, SDATA (color)); } } @@ -7761,14 +7761,14 @@ xpm_load (f, img) } rc = XpmReadFileToPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - XSTRING (file)->data, &img->pixmap, &img->mask, + SDATA (file), &img->pixmap, &img->mask, &attrs); } else { Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL); rc = XpmCreatePixmapFromBuffer (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - XSTRING (buffer)->data, + SDATA (buffer), &img->pixmap, &img->mask, &attrs); } @@ -8568,7 +8568,7 @@ pbm_load (f, img) return 0; } - contents = slurp_file (XSTRING (file)->data, &size); + contents = slurp_file (SDATA (file), &size); if (contents == NULL) { image_error ("Error reading `%s'", file, Qnil); @@ -8583,8 +8583,8 @@ pbm_load (f, img) { Lisp_Object data; data = image_spec_value (img->spec, QCdata, NULL); - p = XSTRING (data)->data; - end = p + STRING_BYTES (XSTRING (data)); + p = SDATA (data); + end = p + SBYTES (data); } /* Check magic number. */ @@ -8933,7 +8933,7 @@ png_load (f, img) } /* Open the image file. */ - fp = fopen (XSTRING (file)->data, "rb"); + fp = fopen (SDATA (file), "rb"); if (!fp) { image_error ("Cannot open image file `%s'", file, Qnil); @@ -8955,8 +8955,8 @@ png_load (f, img) else { /* Read from memory. */ - tbr.bytes = XSTRING (specified_data)->data; - tbr.len = STRING_BYTES (XSTRING (specified_data)); + tbr.bytes = SDATA (specified_data); + tbr.len = SBYTES (specified_data); tbr.index = 0; /* Check PNG signature. */ @@ -9079,7 +9079,7 @@ png_load (f, img) /* The user specified `:background', use that. */ { XColor color; - if (x_defined_color (f, XSTRING (specified_bg)->data, &color, 0)) + if (x_defined_color (f, SDATA (specified_bg), &color, 0)) { png_color_16 user_bg; @@ -9499,7 +9499,7 @@ jpeg_load (f, img) return 0; } - fp = fopen (XSTRING (file)->data, "r"); + fp = fopen (SDATA (file), "r"); if (fp == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -9546,8 +9546,8 @@ jpeg_load (f, img) if (NILP (specified_data)) jpeg_stdio_src (&cinfo, (FILE *) fp); else - jpeg_memory_src (&cinfo, XSTRING (specified_data)->data, - STRING_BYTES (XSTRING (specified_data))); + jpeg_memory_src (&cinfo, SDATA (specified_data), + SBYTES (specified_data)); jpeg_read_header (&cinfo, TRUE); @@ -9893,7 +9893,7 @@ tiff_load (f, img) } /* Try to open the image file. */ - tiff = TIFFOpen (XSTRING (file)->data, "r"); + tiff = TIFFOpen (SDATA (file), "r"); if (tiff == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -9904,8 +9904,8 @@ tiff_load (f, img) else { /* Memory source! */ - memsrc.bytes = XSTRING (specified_data)->data; - memsrc.len = STRING_BYTES (XSTRING (specified_data)); + memsrc.bytes = SDATA (specified_data); + memsrc.len = SBYTES (specified_data); memsrc.index = 0; tiff = TIFFClientOpen ("memory_source", "r", &memsrc, @@ -10142,7 +10142,7 @@ gif_load (f, img) } /* Open the GIF file. */ - gif = DGifOpenFileName (XSTRING (file)->data); + gif = DGifOpenFileName (SDATA (file)); if (gif == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -10154,8 +10154,8 @@ gif_load (f, img) { /* Read from memory! */ current_gif_memory_src = &memsrc; - memsrc.bytes = XSTRING (specified_data)->data; - memsrc.len = STRING_BYTES (XSTRING (specified_data)); + memsrc.bytes = SDATA (specified_data); + memsrc.len = SBYTES (specified_data); memsrc.index = 0; gif = DGifOpen(&memsrc, gif_read_from_memory); @@ -10605,10 +10605,10 @@ selected frame. Value is VALUE. */) CHECK_STRING (value); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_X_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SDATA (prop), False); XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom, XA_STRING, 8, PropModeReplace, - XSTRING (value)->data, XSTRING (value)->size); + SDATA (value), SCHARS (value)); /* Make sure the property is set when we return. */ XFlush (FRAME_X_DISPLAY (f)); @@ -10630,7 +10630,7 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) CHECK_STRING (prop); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_X_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SDATA (prop), False); XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom); /* Make sure the property is removed when we return. */ @@ -10661,7 +10661,7 @@ value. */) CHECK_STRING (prop); BLOCK_INPUT; - prop_atom = XInternAtom (FRAME_X_DISPLAY (f), XSTRING (prop)->data, False); + prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SDATA (prop), False); rc = XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom, 0, 0, False, XA_STRING, &actual_type, &actual_format, &actual_size, @@ -11054,9 +11054,9 @@ x_create_tip_frame (dpyinfo, parms, text) { tem = Fquery_fontset (font, Qnil); if (STRINGP (tem)) - font = x_new_fontset (f, XSTRING (tem)->data); + font = x_new_fontset (f, SDATA (tem)); else - font = x_new_font (f, XSTRING (font)->data); + font = x_new_font (f, SDATA (font)); } /* Try out a font which we hope has bold and italic variations. */ @@ -11620,10 +11620,10 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */) /* Create the dialog with PROMPT as title, using DIR as initial directory and using "*" as pattern. */ dir = Fexpand_file_name (dir, Qnil); - dir_xmstring = XmStringCreateLocalized (XSTRING (dir)->data); + dir_xmstring = XmStringCreateLocalized (SDATA (dir)); pattern_xmstring = XmStringCreateLocalized ("*"); - XtSetArg (al[ac], XmNtitle, XSTRING (prompt)->data); ++ac; + XtSetArg (al[ac], XmNtitle, SDATA (prompt)); ++ac; XtSetArg (al[ac], XmNdirectory, dir_xmstring); ++ac; XtSetArg (al[ac], XmNpattern, pattern_xmstring); ++ac; XtSetArg (al[ac], XmNresizePolicy, XmRESIZE_GROW); ++ac; @@ -11674,7 +11674,7 @@ selection dialog's entry field, if MUSTMATCH is non-nil. */) int item_pos; default_xmstring - = XmStringCreateLocalized (XSTRING (default_filename)->data); + = XmStringCreateLocalized (SDATA (default_filename)); if (!XmListItemExists (list, default_xmstring)) { diff --git a/src/xmenu.c b/src/xmenu.c index 35ddfe9258a..cc613bedeb1 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -505,7 +505,7 @@ single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth, enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE]; item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME]; - if (!NILP (map) && XSTRING (item_string)->data[0] == '@') + if (!NILP (map) && SREF (item_string, 0) == '@') { if (!NILP (enabled)) /* An enabled separate pane. Remember this to handle it later. */ @@ -551,8 +551,8 @@ single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth, index++; /* Skip a left, right divider. */ else { - if (!submenu && XSTRING (tem)->data[0] != '\0' - && XSTRING (tem)->data[0] != '-') + if (!submenu && SREF (tem, 0) != '\0' + && SREF (tem, 0) != '-') XVECTOR (menu_items)->contents[index + MENU_ITEMS_ITEM_NAME] = concat2 (build_string (" "), tem); index += MENU_ITEMS_ITEM_LENGTH; @@ -568,8 +568,8 @@ single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth, prefix = build_string (NILP (selected) ? "( ) " : "(*) "); } /* Not a button. If we have earlier buttons, then we need a prefix. */ - else if (!*notbuttons_ptr && XSTRING (item_string)->data[0] != '\0' - && XSTRING (item_string)->data[0] != '-') + else if (!*notbuttons_ptr && SREF (item_string, 0) != '\0' + && SREF (item_string, 0) != '-') prefix = build_string (" "); if (!NILP (prefix)) @@ -1453,7 +1453,7 @@ single_submenu (item_key, item_name, maps) } #endif pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); /* If there is just one top-level pane, put all its items directly under the top-level menu. */ if (menu_items_n_panes == 1) @@ -1517,9 +1517,9 @@ single_submenu (item_key, item_name, maps) else save_wv->contents = wv; - wv->name = (char *) XSTRING (item_name)->data; + wv->name = (char *) SDATA (item_name); if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; + wv->key = (char *) SDATA (descrip); wv->value = 0; /* The EMACS_INT cast avoids a warning. There's no problem as long as pointers have enough bits to hold small integers. */ @@ -1753,7 +1753,7 @@ set_frame_menubar (f, first_time, deep_p) string = XVECTOR (items)->contents[i + 1]; if (NILP (string)) break; - wv->name = (char *) XSTRING (string)->data; + wv->name = (char *) SDATA (string); wv = wv->next; } @@ -1776,7 +1776,7 @@ set_frame_menubar (f, first_time, deep_p) break; wv = xmalloc_widget_value (); - wv->name = (char *) XSTRING (string)->data; + wv->name = (char *) SDATA (string); wv->value = 0; wv->enabled = 1; wv->button_type = BUTTON_TYPE_NONE; @@ -2051,7 +2051,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) } #endif pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); /* If there is just one top-level pane, put all its items directly under the top-level menu. */ if (menu_items_n_panes == 1) @@ -2116,9 +2116,9 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) prev_wv->next = wv; else save_wv->contents = wv; - wv->name = (char *) XSTRING (item_name)->data; + wv->name = (char *) SDATA (item_name); if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; + wv->key = (char *) SDATA (descrip); wv->value = 0; /* If this item has a null value, make the call_data null so that it won't display a box @@ -2169,7 +2169,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) title = ENCODE_SYSTEM (title); #endif - wv_title->name = (char *) XSTRING (title)->data; + wv_title->name = (char *) SDATA (title); wv_title->enabled = TRUE; wv_title->button_type = BUTTON_TYPE_NONE; wv_title->next = wv_sep1; @@ -2370,7 +2370,7 @@ xdialog_show (f, keymaps, title, error) pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); prev_wv = xmalloc_widget_value (); prev_wv->value = pane_string; if (keymaps && !NILP (prefix)) @@ -2417,8 +2417,8 @@ xdialog_show (f, keymaps, title, error) prev_wv->next = wv; wv->name = (char *) button_names[nb_buttons]; if (!NILP (descrip)) - wv->key = (char *) XSTRING (descrip)->data; - wv->value = (char *) XSTRING (item_name)->data; + wv->key = (char *) SDATA (descrip); + wv->value = (char *) SDATA (item_name); wv->call_data = (void *) &XVECTOR (menu_items)->contents[i]; wv->enabled = !NILP (enable); wv->help = Qnil; @@ -2656,7 +2656,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; pane_string = (NILP (pane_name) - ? "" : (char *) XSTRING (pane_name)->data); + ? "" : (char *) SDATA (pane_name)); if (keymaps && !NILP (prefix)) pane_string++; @@ -2683,7 +2683,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) j++; continue; } - width = STRING_BYTES (XSTRING (item)); + width = SBYTES (item); if (width > maxwidth) maxwidth = width; @@ -2706,34 +2706,34 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) descrip = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; - help_string = STRINGP (help) ? XSTRING (help)->data : NULL; + help_string = STRINGP (help) ? SDATA (help) : NULL; if (!NILP (descrip)) { - int gap = maxwidth - STRING_BYTES (XSTRING (item_name)); + int gap = maxwidth - SBYTES (item_name); #ifdef C_ALLOCA Lisp_Object spacer; spacer = Fmake_string (make_number (gap), make_number (' ')); item_name = concat2 (item_name, spacer); item_name = concat2 (item_name, descrip); - item_data = XSTRING (item_name)->data; + item_data = SDATA (item_name); #else /* if alloca is fast, use that to make the space, to reduce gc needs. */ item_data = (unsigned char *) alloca (maxwidth - + STRING_BYTES (XSTRING (descrip)) + 1); - bcopy (XSTRING (item_name)->data, item_data, - STRING_BYTES (XSTRING (item_name))); - for (j = XSTRING (item_name)->size; j < maxwidth; j++) + + SBYTES (descrip) + 1); + bcopy (SDATA (item_name), item_data, + SBYTES (item_name)); + for (j = SCHARS (item_name); j < maxwidth; j++) item_data[j] = ' '; - bcopy (XSTRING (descrip)->data, item_data + j, - STRING_BYTES (XSTRING (descrip))); - item_data[j + STRING_BYTES (XSTRING (descrip))] = 0; + bcopy (SDATA (descrip), item_data + j, + SBYTES (descrip)); + item_data[j + SBYTES (descrip)] = 0; #endif } else - item_data = XSTRING (item_name)->data; + item_data = SDATA (item_name); if (XMenuAddSelection (FRAME_X_DISPLAY (f), menu, lpane, 0, item_data, diff --git a/src/xselect.c b/src/xselect.c index 1d5fe0b8ea2..5519eecf64c 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -200,9 +200,9 @@ symbol_to_x_atom (dpyinfo, display, sym) #endif if (!SYMBOLP (sym)) abort (); - TRACE1 (" XInternAtom %s", (char *) XSTRING (SYMBOL_NAME (sym))->data); + TRACE1 (" XInternAtom %s", (char *) SDATA (SYMBOL_NAME (sym))); BLOCK_INPUT; - val = XInternAtom (display, (char *) XSTRING (SYMBOL_NAME (sym))->data, False); + val = XInternAtom (display, (char *) SDATA (SYMBOL_NAME (sym)), False); UNBLOCK_INPUT; return val; } @@ -1272,7 +1272,7 @@ x_get_foreign_selection (selection_symbol, target_type) if (NILP (XCAR (reading_selection_reply))) error ("Timed out waiting for reply from selection owner"); if (EQ (XCAR (reading_selection_reply), Qlambda)) - error ("No `%s' selection", XSTRING (SYMBOL_NAME (selection_symbol))->data); + error ("No `%s' selection", SDATA (SYMBOL_NAME (selection_symbol))); /* Otherwise, the selection is waiting for us on the requested property. */ return @@ -1662,7 +1662,7 @@ selection_data_to_lisp_data (display, data, size, type, format) str = run_pre_post_conversion_on_str (str, &coding, 0); Vlast_coding_system_used = coding.symbol; } - compose_chars_in_text (0, XSTRING (str)->size, str); + compose_chars_in_text (0, SCHARS (str), str); return str; } /* Convert a single atom to a Lisp_Symbol. Convert a set of atoms to @@ -1778,7 +1778,7 @@ lisp_data_to_selection_data (display, obj, Lisp_Object unibyte_string; unibyte_string = string_make_unibyte (obj); - *data_ret = XSTRING (unibyte_string)->data; + *data_ret = SDATA (unibyte_string); *nofree_ret = 1; *size_ret = SBYTES (unibyte_string); } @@ -1786,7 +1786,7 @@ lisp_data_to_selection_data (display, obj, { *data_ret = x_encode_text (obj, Vnext_selection_coding_system, 1, (int *) size_ret, &stringp); - *nofree_ret = (*data_ret == XSTRING (obj)->data); + *nofree_ret = (*data_ret == SDATA (obj)); } if (NILP (type)) type = (stringp ? QSTRING : QCOMPOUND_TEXT); @@ -2277,8 +2277,8 @@ DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal, CHECK_STRING (string); buffer_atom = symbol_to_x_atom (FRAME_X_DISPLAY_INFO (sf), display, buffer); - data = (unsigned char *) XSTRING (string)->data; - bytes = STRING_BYTES (XSTRING (string)); + data = (unsigned char *) SDATA (string); + bytes = SBYTES (string); bytes_remaining = bytes; if (! FRAME_X_DISPLAY_INFO (sf)->cut_buffers_initialized) diff --git a/src/xsmfns.c b/src/xsmfns.c index 44f083048e9..6db774e7a9f 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -216,8 +216,8 @@ smc_save_yourself_CB (smcConn, props[props_idx]->type = SmARRAY8; props[props_idx]->num_vals = 1; props[props_idx]->vals = &values[val_idx++]; - props[props_idx]->vals[0].length = strlen (XSTRING (Vinvocation_name)->data); - props[props_idx]->vals[0].value = XSTRING (Vinvocation_name)->data; + props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name)); + props[props_idx]->vals[0].value = SDATA (Vinvocation_name); ++props_idx; /* How to restart Emacs (i.e.: /path/to/emacs --smid=xxxx). */ @@ -244,8 +244,8 @@ smc_save_yourself_CB (smcConn, props[props_idx]->type = SmARRAY8; props[props_idx]->num_vals = 1; props[props_idx]->vals = &values[val_idx++]; - props[props_idx]->vals[0].length = strlen (XSTRING (Vuser_login_name)->data); - props[props_idx]->vals[0].value = XSTRING (Vuser_login_name)->data; + props[props_idx]->vals[0].length = strlen (SDATA (Vuser_login_name)); + props[props_idx]->vals[0].value = SDATA (Vuser_login_name); ++props_idx; /* The current directory property, not mandatory */ @@ -407,12 +407,12 @@ x_session_initialize () /* Check if we where started by the session manager. If so, we will have a previous id. */ if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id)) - previous_id = XSTRING (Vx_session_previous_id)->data; + previous_id = SDATA (Vx_session_previous_id); /* Construct the path to the Emacs program. */ if (! EQ (Vinvocation_directory, Qnil)) - name_len += strlen (XSTRING (Vinvocation_directory)->data); - name_len += strlen (XSTRING (Vinvocation_name)->data); + name_len += strlen (SDATA (Vinvocation_directory)); + name_len += strlen (SDATA (Vinvocation_name)); /* This malloc will not be freed, but it is only done once, and hopefully not very large */ @@ -420,8 +420,8 @@ x_session_initialize () emacs_program[0] = '\0'; if (! EQ (Vinvocation_directory, Qnil)) - strcpy (emacs_program, XSTRING (Vinvocation_directory)->data); - strcat (emacs_program, XSTRING (Vinvocation_name)->data); + strcpy (emacs_program, SDATA (Vinvocation_directory)); + strcat (emacs_program, SDATA (Vinvocation_name)); /* The SM protocol says all callbacks are mandatory, so set up all here and in the mask passed to SmcOpenConnection */ diff --git a/src/xterm.c b/src/xterm.c index 0067643c89f..5796ff9e8b9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7269,7 +7269,7 @@ note_mouse_highlight (f, x, y) if (NILP (b)) b = make_number (0); if (NILP (e)) - e = make_number (XSTRING (object)->size - 1); + e = make_number (SCHARS (object) - 1); fast_find_string_pos (w, XINT (b), object, &dpyinfo->mouse_face_beg_col, &dpyinfo->mouse_face_beg_row, @@ -7367,7 +7367,7 @@ note_mouse_highlight (f, x, y) /* Try text properties. */ if (STRINGP (object) && charpos >= 0 - && charpos < XSTRING (object)->size) + && charpos < SCHARS (object)) { help = Fget_text_property (make_number (charpos), Qhelp_echo, object); @@ -12099,7 +12099,7 @@ x_error_catcher (display, error) XErrorEvent *error; { XGetErrorText (display, error->error_code, - XSTRING (x_error_message_string)->data, + SDATA (x_error_message_string), X_ERROR_MESSAGE_SIZE); } @@ -12131,7 +12131,7 @@ x_catch_errors (dpy) record_unwind_protect (x_catch_errors_unwind, x_error_message_string); x_error_message_string = make_uninit_string (X_ERROR_MESSAGE_SIZE); - XSTRING (x_error_message_string)->data[0] = 0; + SREF (x_error_message_string, 0) = 0; return count; } @@ -12158,8 +12158,8 @@ x_check_errors (dpy, format) /* Make sure to catch any errors incurred so far. */ XSync (dpy, False); - if (XSTRING (x_error_message_string)->data[0]) - error (format, XSTRING (x_error_message_string)->data); + if (SREF (x_error_message_string, 0)) + error (format, SDATA (x_error_message_string)); } /* Nonzero if we had any X protocol errors @@ -12172,7 +12172,7 @@ x_had_errors_p (dpy) /* Make sure to catch any errors incurred so far. */ XSync (dpy, False); - return XSTRING (x_error_message_string)->data[0] != 0; + return SREF (x_error_message_string, 0) != 0; } /* Forget about any errors we have had, since we did x_catch_errors on DPY. */ @@ -12181,7 +12181,7 @@ void x_clear_errors (dpy) Display *dpy; { - XSTRING (x_error_message_string)->data[0] = 0; + SREF (x_error_message_string, 0) = 0; } /* Stop catching X protocol errors and let them make Emacs die. @@ -12481,7 +12481,7 @@ x_new_fontset (f, fontsetname) to do. */ return fontset_name (fontset); - result = x_new_font (f, (XSTRING (fontset_ascii (fontset))->data)); + result = x_new_font (f, (SDATA (fontset_ascii (fontset)))); if (!STRINGP (result)) /* Can't load ASCII font. */ @@ -12493,7 +12493,7 @@ x_new_fontset (f, fontsetname) #ifdef HAVE_X_I18N if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea))) - xic_set_xfontset (f, XSTRING (fontset_ascii (fontset))->data); + xic_set_xfontset (f, SDATA (fontset_ascii (fontset))); #endif return build_string (fontsetname); @@ -14093,7 +14093,7 @@ x_list_fonts (f, pattern, size, maxnames) XFontStruct *font; unsigned long value; - font = XLoadQueryFont (dpy, XSTRING (pattern)->data); + font = XLoadQueryFont (dpy, SDATA (pattern)); if (x_had_errors_p (dpy)) { /* This error is perhaps due to insufficient memory on X @@ -14136,7 +14136,7 @@ x_list_fonts (f, pattern, size, maxnames) { /* We try at least 10 fonts because XListFonts will return auto-scaled fonts at the head. */ - names = XListFonts (dpy, XSTRING (pattern)->data, max (maxnames, 10), + names = XListFonts (dpy, SDATA (pattern), max (maxnames, 10), &num_fonts); if (x_had_errors_p (dpy)) { @@ -14237,7 +14237,7 @@ x_list_fonts (f, pattern, size, maxnames) BLOCK_INPUT; count = x_catch_errors (dpy); thisinfo = XLoadQueryFont (dpy, - XSTRING (XCAR (tem))->data); + SDATA (XCAR (tem))); if (x_had_errors_p (dpy)) { /* This error is perhaps due to insufficient memory on X @@ -14417,9 +14417,9 @@ x_load_font (f, fontname, size) for (tail = font_names; CONSP (tail); tail = XCDR (tail)) if (dpyinfo->font_table[i].name && (!strcmp (dpyinfo->font_table[i].name, - XSTRING (XCAR (tail))->data) + SDATA (XCAR (tail))) || !strcmp (dpyinfo->font_table[i].full_name, - XSTRING (XCAR (tail))->data))) + SDATA (XCAR (tail))))) return (dpyinfo->font_table + i); } @@ -14437,7 +14437,7 @@ x_load_font (f, fontname, size) a bug of not finding a font even if the font surely exists and is loadable by XLoadQueryFont. */ if (size > 0 && !NILP (font_names)) - fontname = (char *) XSTRING (XCAR (font_names))->data; + fontname = (char *) SDATA (XCAR (font_names)); BLOCK_INPUT; count = x_catch_errors (FRAME_X_DISPLAY (f)); @@ -14689,7 +14689,7 @@ same_x_server (name1, name2) char *name1, *name2; { int seen_colon = 0; - unsigned char *system_name = XSTRING (Vsystem_name)->data; + unsigned char *system_name = SDATA (Vsystem_name); int system_name_length = strlen (system_name); int length_until_period = 0; @@ -14771,7 +14771,7 @@ x_term_init (display_name, xrm_option, resource_name) argv[argc++] = xrm_option; } stop_polling (); - dpy = XtOpenDisplay (Xt_app_con, XSTRING (display_name)->data, + dpy = XtOpenDisplay (Xt_app_con, SDATA (display_name), resource_name, EMACS_CLASS, emacs_options, XtNumber (emacs_options), &argc, argv); @@ -14787,7 +14787,7 @@ x_term_init (display_name, xrm_option, resource_name) #ifdef HAVE_X11R5 XSetLocaleModifiers (""); #endif - dpy = XOpenDisplay (XSTRING (display_name)->data); + dpy = XOpenDisplay (SDATA (display_name)); #endif /* not USE_X_TOOLKIT */ /* Detect failure. */ @@ -14809,8 +14809,8 @@ x_term_init (display_name, xrm_option, resource_name) for (share = x_display_list, tail = x_display_name_list; share; share = share->next, tail = XCDR (tail)) - if (same_x_server (XSTRING (XCAR (XCAR (tail)))->data, - XSTRING (display_name)->data)) + if (same_x_server (SDATA (XCAR (XCAR (tail))), + SDATA (display_name))) break; if (share) dpyinfo->kboard = share->kboard; @@ -14856,11 +14856,11 @@ x_term_init (display_name, xrm_option, resource_name) #endif /* ! 0 */ dpyinfo->x_id_name - = (char *) xmalloc (STRING_BYTES (XSTRING (Vinvocation_name)) - + STRING_BYTES (XSTRING (Vsystem_name)) + = (char *) xmalloc (SBYTES (Vinvocation_name) + + SBYTES (Vsystem_name) + 2); sprintf (dpyinfo->x_id_name, "%s@%s", - XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data); + SDATA (Vinvocation_name), SDATA (Vsystem_name)); /* Figure out which modifier bits mean what. */ x_find_modifier_meanings (dpyinfo); @@ -14923,8 +14923,8 @@ x_term_init (display_name, xrm_option, resource_name) build_string ("PrivateColormap"), Qnil, Qnil); if (STRINGP (value) - && (!strcmp (XSTRING (value)->data, "true") - || !strcmp (XSTRING (value)->data, "on"))) + && (!strcmp (SDATA (value), "true") + || !strcmp (SDATA (value), "on"))) dpyinfo->cmap = XCopyColormapAndFree (dpyinfo->display, dpyinfo->cmap); } } @@ -15084,8 +15084,8 @@ x_term_init (display_name, xrm_option, resource_name) build_string ("Synchronous"), Qnil, Qnil); if (STRINGP (value) - && (!strcmp (XSTRING (value)->data, "true") - || !strcmp (XSTRING (value)->data, "on"))) + && (!strcmp (SDATA (value), "true") + || !strcmp (SDATA (value), "on"))) XSynchronize (dpyinfo->display, True); } |