Commit d5db4077 authored by Ken Raeburn's avatar Ken Raeburn

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.
parent 491c2516
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.
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
}
......