aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-03-21 07:06:14 +0000
committerRichard M. Stallman1998-03-21 07:06:14 +0000
commitfc932ac6c7b54ac6f79222a2548707a97d3a44f4 (patch)
tree88f9f2ff546b9d84c11515967b4bb5cc3c16d080 /src
parente7654b4a743e7c54c08629ee336e10a5f1089da6 (diff)
downloademacs-fc932ac6c7b54ac6f79222a2548707a97d3a44f4.tar.gz
emacs-fc932ac6c7b54ac6f79222a2548707a97d3a44f4.zip
Use STRING_BYTES and SET_STRING_BYTES.
Diffstat (limited to 'src')
-rw-r--r--src/abbrev.c6
-rw-r--r--src/alloc.c8
-rw-r--r--src/buffer.c16
-rw-r--r--src/bytecode.c2
-rw-r--r--src/callint.c5
-rw-r--r--src/callproc.c16
-rw-r--r--src/casefiddle.c2
-rw-r--r--src/category.c4
-rw-r--r--src/ccl.c4
-rw-r--r--src/charset.c7
-rw-r--r--src/coding.c11
-rw-r--r--src/data.c4
-rw-r--r--src/dispnew.c5
-rw-r--r--src/doc.c14
-rw-r--r--src/fileio.c32
-rw-r--r--src/filelock.c2
-rw-r--r--src/fns.c38
-rw-r--r--src/frame.c4
-rw-r--r--src/insdel.c4
-rw-r--r--src/keyboard.c29
-rw-r--r--src/keymap.c2
-rw-r--r--src/lread.c12
-rw-r--r--src/minibuf.c44
-rw-r--r--src/print.c10
-rw-r--r--src/process.c20
-rw-r--r--src/search.c30
-rw-r--r--src/xdisp.c14
-rw-r--r--src/xfns.c46
-rw-r--r--src/xmenu.c12
-rw-r--r--src/xselect.c4
-rw-r--r--src/xterm.c4
31 files changed, 210 insertions, 201 deletions
diff --git a/src/abbrev.c b/src/abbrev.c
index ebe89e8cc73..f681ed947c6 100644
--- a/src/abbrev.c
+++ b/src/abbrev.c
@@ -324,7 +324,7 @@ Returns the abbrev symbol, if expansion took place.")
324 del_range_both (wordstart, wordstart_byte, wordend, wordend_byte, 1); 324 del_range_both (wordstart, wordstart_byte, wordend, wordend_byte, 1);
325 325
326 insert_from_string (expansion, 0, 0, XSTRING (expansion)->size, 326 insert_from_string (expansion, 0, 0, XSTRING (expansion)->size,
327 XSTRING (expansion)->size_byte, 1); 327 STRING_BYTES (XSTRING (expansion)), 1);
328 SET_PT (PT + whitecnt); 328 SET_PT (PT + whitecnt);
329 329
330 if (uccount && !lccount) 330 if (uccount && !lccount)
@@ -390,11 +390,11 @@ is not undone.")
390 if (!STRINGP (val)) 390 if (!STRINGP (val))
391 error ("value of abbrev-symbol must be a string"); 391 error ("value of abbrev-symbol must be a string");
392 zv_before = ZV; 392 zv_before = ZV;
393 del_range_byte (PT_BYTE, PT_BYTE + XSTRING (val)->size_byte, 1); 393 del_range_byte (PT_BYTE, PT_BYTE + STRING_BYTES (XSTRING (val)), 1);
394 /* Don't inherit properties here; just copy from old contents. */ 394 /* Don't inherit properties here; just copy from old contents. */
395 insert_from_string (Vlast_abbrev_text, 0, 0, 395 insert_from_string (Vlast_abbrev_text, 0, 0,
396 XSTRING (Vlast_abbrev_text)->size, 396 XSTRING (Vlast_abbrev_text)->size,
397 XSTRING (Vlast_abbrev_text)->size_byte, 0); 397 STRING_BYTES (XSTRING (Vlast_abbrev_text)), 0);
398 Vlast_abbrev_text = Qnil; 398 Vlast_abbrev_text = Qnil;
399 /* Total number of characters deleted. */ 399 /* Total number of characters deleted. */
400 adjust = ZV - zv_before; 400 adjust = ZV - zv_before;
diff --git a/src/alloc.c b/src/alloc.c
index 337a7f0ede5..5948229cc4b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1376,7 +1376,7 @@ make_uninit_multibyte_string (length, length_byte)
1376 1376
1377 string_chars_consed += fullsize; 1377 string_chars_consed += fullsize;
1378 XSTRING (val)->size = length; 1378 XSTRING (val)->size = length;
1379 XSTRING (val)->size_byte = length_byte; 1379 SET_STRING_BYTES (XSTRING (val), length_byte);
1380 XSTRING (val)->data[length_byte] = 0; 1380 XSTRING (val)->data[length_byte] = 0;
1381 INITIALIZE_INTERVAL (XSTRING (val), NULL_INTERVAL); 1381 INITIALIZE_INTERVAL (XSTRING (val), NULL_INTERVAL);
1382 1382
@@ -1442,7 +1442,7 @@ make_pure_string (data, length, length_byte)
1442 error ("Pure Lisp storage exhausted"); 1442 error ("Pure Lisp storage exhausted");
1443 XSETSTRING (new, PUREBEG + pureptr); 1443 XSETSTRING (new, PUREBEG + pureptr);
1444 XSTRING (new)->size = length; 1444 XSTRING (new)->size = length;
1445 XSTRING (new)->size_byte = length_byte; 1445 SET_STRING_BYTES (XSTRING (new), length_byte);
1446 bcopy (data, XSTRING (new)->data, length_byte); 1446 bcopy (data, XSTRING (new)->data, length_byte);
1447 XSTRING (new)->data[length_byte] = 0; 1447 XSTRING (new)->data[length_byte] = 0;
1448 1448
@@ -1548,7 +1548,7 @@ Does not copy symbols.")
1548#endif /* LISP_FLOAT_TYPE */ 1548#endif /* LISP_FLOAT_TYPE */
1549 else if (STRINGP (obj)) 1549 else if (STRINGP (obj))
1550 return make_pure_string (XSTRING (obj)->data, XSTRING (obj)->size, 1550 return make_pure_string (XSTRING (obj)->data, XSTRING (obj)->size,
1551 XSTRING (obj)->size_byte); 1551 STRING_BYTES (XSTRING (obj)));
1552 else if (COMPILEDP (obj) || VECTORP (obj)) 1552 else if (COMPILEDP (obj) || VECTORP (obj))
1553 { 1553 {
1554 register struct Lisp_Vector *vec; 1554 register struct Lisp_Vector *vec;
@@ -2646,7 +2646,7 @@ compact_strings ()
2646 2646
2647 register struct Lisp_String *newaddr; 2647 register struct Lisp_String *newaddr;
2648 register EMACS_INT size = nextstr->size; 2648 register EMACS_INT size = nextstr->size;
2649 EMACS_INT size_byte = nextstr->size_byte; 2649 EMACS_INT size_byte = STRING_BYTES (nextstr);
2650 2650
2651 /* NEXTSTR is the old address of the next string. 2651 /* NEXTSTR is the old address of the next string.
2652 Just skip it if it isn't marked. */ 2652 Just skip it if it isn't marked. */
diff --git a/src/buffer.c b/src/buffer.c
index 8663ff30589..69010af7cd0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2364,9 +2364,9 @@ record_overlay_string (ssl, str, str2, pri, size)
2364 nbytes = XSTRING (str)->size; 2364 nbytes = XSTRING (str)->size;
2365 else if (! STRING_MULTIBYTE (str)) 2365 else if (! STRING_MULTIBYTE (str))
2366 nbytes = count_size_as_multibyte (XSTRING (str)->data, 2366 nbytes = count_size_as_multibyte (XSTRING (str)->data,
2367 XSTRING (str)->size_byte); 2367 STRING_BYTES (XSTRING (str)));
2368 else 2368 else
2369 nbytes = XSTRING (str)->size_byte; 2369 nbytes = STRING_BYTES (XSTRING (str));
2370 2370
2371 ssl->bytes += nbytes; 2371 ssl->bytes += nbytes;
2372 2372
@@ -2376,9 +2376,9 @@ record_overlay_string (ssl, str, str2, pri, size)
2376 nbytes = XSTRING (str2)->size; 2376 nbytes = XSTRING (str2)->size;
2377 else if (! STRING_MULTIBYTE (str2)) 2377 else if (! STRING_MULTIBYTE (str2))
2378 nbytes = count_size_as_multibyte (XSTRING (str2)->data, 2378 nbytes = count_size_as_multibyte (XSTRING (str2)->data,
2379 XSTRING (str2)->size_byte); 2379 STRING_BYTES (XSTRING (str2)));
2380 else 2380 else
2381 nbytes = XSTRING (str2)->size_byte; 2381 nbytes = STRING_BYTES (XSTRING (str2));
2382 2382
2383 ssl->bytes += nbytes; 2383 ssl->bytes += nbytes;
2384 } 2384 }
@@ -2490,7 +2490,8 @@ overlay_strings (pos, w, pstr)
2490 { 2490 {
2491 int nbytes; 2491 int nbytes;
2492 tem = overlay_tails.buf[i].string; 2492 tem = overlay_tails.buf[i].string;
2493 nbytes = copy_text (XSTRING (tem)->data, p, XSTRING (tem)->size_byte, 2493 nbytes = copy_text (XSTRING (tem)->data, p,
2494 STRING_BYTES (XSTRING (tem)),
2494 STRING_MULTIBYTE (tem), multibyte); 2495 STRING_MULTIBYTE (tem), multibyte);
2495 p += nbytes; 2496 p += nbytes;
2496 } 2497 }
@@ -2498,14 +2499,15 @@ overlay_strings (pos, w, pstr)
2498 { 2499 {
2499 int nbytes; 2500 int nbytes;
2500 tem = overlay_heads.buf[i].string; 2501 tem = overlay_heads.buf[i].string;
2501 nbytes = copy_text (XSTRING (tem)->data, p, XSTRING (tem)->size_byte, 2502 nbytes = copy_text (XSTRING (tem)->data, p,
2503 STRING_BYTES (XSTRING (tem)),
2502 STRING_MULTIBYTE (tem), multibyte); 2504 STRING_MULTIBYTE (tem), multibyte);
2503 p += nbytes; 2505 p += nbytes;
2504 tem = overlay_heads.buf[i].string2; 2506 tem = overlay_heads.buf[i].string2;
2505 if (STRINGP (tem)) 2507 if (STRINGP (tem))
2506 { 2508 {
2507 nbytes = copy_text (XSTRING (tem)->data, p, 2509 nbytes = copy_text (XSTRING (tem)->data, p,
2508 XSTRING (tem)->size_byte, 2510 STRING_BYTES (XSTRING (tem)),
2509 STRING_MULTIBYTE (tem), multibyte); 2511 STRING_MULTIBYTE (tem), multibyte);
2510 p += nbytes; 2512 p += nbytes;
2511 } 2513 }
diff --git a/src/bytecode.c b/src/bytecode.c
index 193630f025c..60e34a486fe 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -306,7 +306,7 @@ If the third argument is incorrect, Emacs may crash.")
306 /* Cached address of beginning of string, 306 /* Cached address of beginning of string,
307 valid if BYTESTR equals STRING_SAVED. */ 307 valid if BYTESTR equals STRING_SAVED. */
308 register unsigned char *strbeg; 308 register unsigned char *strbeg;
309 int bytestr_length = XSTRING (bytestr)->size_byte; 309 int bytestr_length = STRING_BYTES (XSTRING (bytestr));
310 310
311 CHECK_STRING (bytestr, 0); 311 CHECK_STRING (bytestr, 0);
312 if (!VECTORP (vector)) 312 if (!VECTORP (vector))
diff --git a/src/callint.c b/src/callint.c
index 0fb5e94082d..fd4ea1aab44 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -288,8 +288,9 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
288 { 288 {
289 /* Make a copy of string so that if a GC relocates specs, 289 /* Make a copy of string so that if a GC relocates specs,
290 `string' will still be valid. */ 290 `string' will still be valid. */
291 string = (unsigned char *) alloca (XSTRING (specs)->size_byte + 1); 291 string = (unsigned char *) alloca (STRING_BYTES (XSTRING (specs)) + 1);
292 bcopy (XSTRING (specs)->data, string, XSTRING (specs)->size_byte + 1); 292 bcopy (XSTRING (specs)->data, string,
293 STRING_BYTES (XSTRING (specs)) + 1);
293 } 294 }
294 else if (string == 0) 295 else if (string == 0)
295 { 296 {
diff --git a/src/callproc.c b/src/callproc.c
index 17c0ee96ee2..2bb18b3bf4c 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -445,7 +445,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
445 for (i = 4; i < nargs; i++) 445 for (i = 4; i < nargs; i++)
446 { 446 {
447 int size = encoding_buffer_size (&argument_coding, 447 int size = encoding_buffer_size (&argument_coding,
448 XSTRING (args[i])->size_byte); 448 STRING_BYTES (XSTRING (args[i])));
449 unsigned char *dummy1 = (unsigned char *) alloca (size); 449 unsigned char *dummy1 = (unsigned char *) alloca (size);
450 int dummy; 450 int dummy;
451 451
@@ -454,7 +454,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
454 encode_coding (&argument_coding, 454 encode_coding (&argument_coding,
455 XSTRING (args[i])->data, 455 XSTRING (args[i])->data,
456 new_argv[i - 3], 456 new_argv[i - 3],
457 XSTRING (args[i])->size_byte, 457 STRING_BYTES (XSTRING (args[i])),
458 size); 458 size);
459 new_argv[i - 3][argument_coding.produced] = 0; 459 new_argv[i - 3][argument_coding.produced] = 0;
460 } 460 }
@@ -837,9 +837,9 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
837 strcat (tempfile, "detmp.XXX"); 837 strcat (tempfile, "detmp.XXX");
838#endif 838#endif
839#else /* not DOS_NT */ 839#else /* not DOS_NT */
840 char *tempfile = (char *) alloca (XSTRING (Vtemp_file_name_pattern)->size_byte + 1); 840 char *tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1);
841 bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile, 841 bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile,
842 XSTRING (Vtemp_file_name_pattern)->size_byte + 1); 842 STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1);
843#endif /* not DOS_NT */ 843#endif /* not DOS_NT */
844 844
845 mktemp (tempfile); 845 mktemp (tempfile);
@@ -977,7 +977,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
977 register char *temp; 977 register char *temp;
978 register int i; 978 register int i;
979 979
980 i = XSTRING (current_dir)->size_byte; 980 i = STRING_BYTES (XSTRING (current_dir));
981 pwd_var = (char *) alloca (i + 6); 981 pwd_var = (char *) alloca (i + 6);
982 temp = pwd_var + 4; 982 temp = pwd_var + 4;
983 bcopy ("PWD=", pwd_var, 4); 983 bcopy ("PWD=", pwd_var, 4);
@@ -1172,7 +1172,7 @@ getenv_internal (var, varlen, value, valuelen)
1172 1172
1173 entry = XCONS (scan)->car; 1173 entry = XCONS (scan)->car;
1174 if (STRINGP (entry) 1174 if (STRINGP (entry)
1175 && XSTRING (entry)->size_byte > varlen 1175 && STRING_BYTES (XSTRING (entry)) > varlen
1176 && XSTRING (entry)->data[varlen] == '=' 1176 && XSTRING (entry)->data[varlen] == '='
1177#ifdef WINDOWSNT 1177#ifdef WINDOWSNT
1178 /* NT environment variables are case insensitive. */ 1178 /* NT environment variables are case insensitive. */
@@ -1183,7 +1183,7 @@ getenv_internal (var, varlen, value, valuelen)
1183 ) 1183 )
1184 { 1184 {
1185 *value = (char *) XSTRING (entry)->data + (varlen + 1); 1185 *value = (char *) XSTRING (entry)->data + (varlen + 1);
1186 *valuelen = XSTRING (entry)->size_byte - (varlen + 1); 1186 *valuelen = STRING_BYTES (XSTRING (entry)) - (varlen + 1);
1187 return 1; 1187 return 1;
1188 } 1188 }
1189 } 1189 }
@@ -1202,7 +1202,7 @@ This function consults the variable ``process-environment'' for its value.")
1202 int valuelen; 1202 int valuelen;
1203 1203
1204 CHECK_STRING (var, 0); 1204 CHECK_STRING (var, 0);
1205 if (getenv_internal (XSTRING (var)->data, XSTRING (var)->size_byte, 1205 if (getenv_internal (XSTRING (var)->data, STRING_BYTES (XSTRING (var)),
1206 &value, &valuelen)) 1206 &value, &valuelen))
1207 return make_string (value, valuelen); 1207 return make_string (value, valuelen);
1208 else 1208 else
diff --git a/src/casefiddle.c b/src/casefiddle.c
index aa9d36b42fd..d3ddf6cb80e 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -63,7 +63,7 @@ casify_object (flag, obj)
63 int multibyte = STRING_MULTIBYTE (obj); 63 int multibyte = STRING_MULTIBYTE (obj);
64 64
65 obj = Fcopy_sequence (obj); 65 obj = Fcopy_sequence (obj);
66 len = XSTRING (obj)->size_byte; 66 len = STRING_BYTES (XSTRING (obj));
67 67
68 /* Scan all single-byte characters from start of string. */ 68 /* Scan all single-byte characters from start of string. */
69 for (i = 0; i < len;) 69 for (i = 0; i < len;)
diff --git a/src/category.c b/src/category.c
index 85fbaa32d31..d1d2f572afa 100644
--- a/src/category.c
+++ b/src/category.c
@@ -492,7 +492,7 @@ describe_category (value)
492 492
493 mnemonics = Fcategory_set_mnemonics (value); 493 mnemonics = Fcategory_set_mnemonics (value);
494 insert_from_string (mnemonics, 0, 0, XSTRING (mnemonics)->size, 494 insert_from_string (mnemonics, 0, 0, XSTRING (mnemonics)->size,
495 XSTRING (mnemonics)->size_byte, 0); 495 STRING_BYTES (XSTRING (mnemonics)), 0);
496 insert_string ("\n"); 496 insert_string ("\n");
497 return; 497 return;
498} 498}
@@ -526,7 +526,7 @@ describe_category_1 (vector)
526 insert_char (i + 32); 526 insert_char (i + 32);
527 insert (": ", 2); 527 insert (": ", 2);
528 insert_from_string (elt, 0, 0, XSTRING (elt)->size, 528 insert_from_string (elt, 0, 0, XSTRING (elt)->size,
529 XSTRING (elt)->size_byte, 0); 529 STRING_BYTES (XSTRING (elt)), 0);
530 insert ("\n", 1); 530 insert ("\n", 1);
531 } 531 }
532 } 532 }
diff --git a/src/ccl.c b/src/ccl.c
index a41706d3413..8e8575a8f11 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1568,13 +1568,13 @@ is a unibyte string. By default it is a multibyte string.")
1568 if (ccl.ic < i && i < ccl.size) 1568 if (ccl.ic < i && i < ccl.size)
1569 ccl.ic = i; 1569 ccl.ic = i;
1570 } 1570 }
1571 outbufsize = XSTRING (str)->size_byte * ccl.buf_magnification + 256; 1571 outbufsize = STRING_BYTES (XSTRING (str)) * ccl.buf_magnification + 256;
1572 outbuf = (char *) xmalloc (outbufsize); 1572 outbuf = (char *) xmalloc (outbufsize);
1573 if (!outbuf) 1573 if (!outbuf)
1574 error ("Not enough memory"); 1574 error ("Not enough memory");
1575 ccl.last_block = NILP (contin); 1575 ccl.last_block = NILP (contin);
1576 produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf, 1576 produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf,
1577 XSTRING (str)->size_byte, outbufsize, (int *)0); 1577 STRING_BYTES (XSTRING (str)), outbufsize, (int *)0);
1578 for (i = 0; i < 8; i++) 1578 for (i = 0; i < 8; i++)
1579 XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]); 1579 XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]);
1580 XSETINT (XVECTOR (status)->contents[8], ccl.ic); 1580 XSETINT (XVECTOR (status)->contents[8], ccl.ic);
diff --git a/src/charset.c b/src/charset.c
index 7e9d1eab821..af8a2490daf 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -747,7 +747,7 @@ Optional arg TABLE if non-nil is a unification table to look up.")
747 return Qnil; 747 return Qnil;
748 748
749 bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); 749 bzero (charsets, (MAX_CHARSET + 1) * sizeof (int));
750 find_charset_in_str (XSTRING (str)->data, XSTRING (str)->size_byte, 750 find_charset_in_str (XSTRING (str)->data, STRING_BYTES (XSTRING (str)),
751 charsets, table); 751 charsets, table);
752 val = Qnil; 752 val = Qnil;
753 for (i = MAX_CHARSET; i >= 0; i--) 753 for (i = MAX_CHARSET; i >= 0; i--)
@@ -1029,7 +1029,8 @@ the following bytes is not checked.")
1029 Lisp_Object val; 1029 Lisp_Object val;
1030 1030
1031 CHECK_STRING (str, 0); 1031 CHECK_STRING (str, 0);
1032 XSETFASTINT (val, strwidth (XSTRING (str)->data, XSTRING (str)->size_byte)); 1032 XSETFASTINT (val, strwidth (XSTRING (str)->data,
1033 STRING_BYTES (XSTRING (str))));
1033 return val; 1034 return val;
1034} 1035}
1035 1036
@@ -1519,7 +1520,7 @@ DEFUN ("compose-string", Fcompose_string, Scompose_string,
1519 1520
1520 buf[0] = LEADING_CODE_COMPOSITION; 1521 buf[0] = LEADING_CODE_COMPOSITION;
1521 p = XSTRING (str)->data; 1522 p = XSTRING (str)->data;
1522 pend = p + XSTRING (str)->size_byte; 1523 pend = p + STRING_BYTES (XSTRING (str));
1523 i = 1; 1524 i = 1;
1524 while (p < pend) 1525 while (p < pend)
1525 { 1526 {
diff --git a/src/coding.c b/src/coding.c
index 0f6fc3dd985..5e4c0b9afdd 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -4283,7 +4283,8 @@ code_convert_string (str, coding, encodep, nocopy)
4283{ 4283{
4284 int len; 4284 int len;
4285 char *buf; 4285 char *buf;
4286 int from = 0, to = XSTRING (str)->size, to_byte = XSTRING (str)->size_byte; 4286 int from = 0, to = XSTRING (str)->size;
4287 int to_byte = STRING_BYTES (XSTRING (str));
4287 struct gcpro gcpro1; 4288 struct gcpro gcpro1;
4288 Lisp_Object saved_coding_symbol = Qnil; 4289 Lisp_Object saved_coding_symbol = Qnil;
4289 int result; 4290 int result;
@@ -4359,7 +4360,7 @@ code_convert_string (str, coding, encodep, nocopy)
4359 len = encoding_buffer_size (coding, to_byte - from); 4360 len = encoding_buffer_size (coding, to_byte - from);
4360 else 4361 else
4361 len = decoding_buffer_size (coding, to_byte - from); 4362 len = decoding_buffer_size (coding, to_byte - from);
4362 len += from + XSTRING (str)->size_byte - to_byte; 4363 len += from + STRING_BYTES (XSTRING (str)) - to_byte;
4363 GCPRO1 (str); 4364 GCPRO1 (str);
4364 buf = get_conversion_buffer (len); 4365 buf = get_conversion_buffer (len);
4365 UNGCPRO; 4366 UNGCPRO;
@@ -4381,9 +4382,9 @@ code_convert_string (str, coding, encodep, nocopy)
4381 } 4382 }
4382 4383
4383 bcopy (XSTRING (str)->data + to_byte, buf + from + coding->produced, 4384 bcopy (XSTRING (str)->data + to_byte, buf + from + coding->produced,
4384 XSTRING (str)->size_byte - to_byte); 4385 STRING_BYTES (XSTRING (str)) - to_byte);
4385 4386
4386 len = from + XSTRING (str)->size_byte - to_byte; 4387 len = from + STRING_BYTES (XSTRING (str)) - to_byte;
4387 if (encodep) 4388 if (encodep)
4388 str = make_unibyte_string (buf, len + coding->produced); 4389 str = make_unibyte_string (buf, len + coding->produced);
4389 else 4390 else
@@ -4565,7 +4566,7 @@ highest priority.")
4565 CHECK_STRING (string, 0); 4566 CHECK_STRING (string, 0);
4566 4567
4567 return detect_coding_system (XSTRING (string)->data, 4568 return detect_coding_system (XSTRING (string)->data,
4568 XSTRING (string)->size_byte, 4569 STRING_BYTES (XSTRING (string)),
4569 !NILP (highest)); 4570 !NILP (highest));
4570} 4571}
4571 4572
diff --git a/src/data.c b/src/data.c
index bf637585cd0..300782a5a56 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1648,7 +1648,7 @@ or a byte-code object. IDX starts at 0.")
1648 idxval_byte = string_char_to_byte (array, idxval); 1648 idxval_byte = string_char_to_byte (array, idxval);
1649 1649
1650 c = STRING_CHAR (&XSTRING (array)->data[idxval_byte], 1650 c = STRING_CHAR (&XSTRING (array)->data[idxval_byte],
1651 XSTRING (array)->size_byte - idxval_byte); 1651 STRING_BYTES (XSTRING (array)) - idxval_byte);
1652 return make_number (c); 1652 return make_number (c);
1653 } 1653 }
1654 else if (BOOL_VECTOR_P (array)) 1654 else if (BOOL_VECTOR_P (array))
@@ -1847,7 +1847,7 @@ IDX starts at 0.")
1847 p = &XSTRING (array)->data[idxval_byte]; 1847 p = &XSTRING (array)->data[idxval_byte];
1848 1848
1849 actual_len 1849 actual_len
1850 = MULTIBYTE_FORM_LENGTH (p, XSTRING (array)->size_byte - idxval_byte); 1850 = MULTIBYTE_FORM_LENGTH (p, STRING_BYTES (XSTRING (array)) - idxval_byte);
1851 new_len = Fchar_bytes (newelt); 1851 new_len = Fchar_bytes (newelt);
1852 if (actual_len != XINT (new_len)) 1852 if (actual_len != XINT (new_len))
1853 error ("Attempt to change byte length of a string"); 1853 error ("Attempt to change byte length of a string");
diff --git a/src/dispnew.c b/src/dispnew.c
index f85950453e6..5bb97150b77 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -2251,11 +2251,12 @@ Control characters in STRING will have terminal-dependent effects.")
2251{ 2251{
2252 /* ??? Perhaps we should do something special for multibyte strings here. */ 2252 /* ??? Perhaps we should do something special for multibyte strings here. */
2253 CHECK_STRING (string, 0); 2253 CHECK_STRING (string, 0);
2254 fwrite (XSTRING (string)->data, 1, XSTRING (string)->size_byte, stdout); 2254 fwrite (XSTRING (string)->data, 1, STRING_BYTES (XSTRING (string)), stdout);
2255 fflush (stdout); 2255 fflush (stdout);
2256 if (termscript) 2256 if (termscript)
2257 { 2257 {
2258 fwrite (XSTRING (string)->data, 1, XSTRING (string)->size_byte, termscript); 2258 fwrite (XSTRING (string)->data, 1, STRING_BYTES (XSTRING (string)),
2259 termscript);
2259 fflush (termscript); 2260 fflush (termscript);
2260 } 2261 }
2261 return Qnil; 2262 return Qnil;
diff --git a/src/doc.c b/src/doc.c
index adc4529e894..1923c86937a 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -562,11 +562,11 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
562 if (NILP (keymap)) 562 if (NILP (keymap))
563 keymap = Voverriding_local_map; 563 keymap = Voverriding_local_map;
564 564
565 bsize = XSTRING (string)->size_byte; 565 bsize = STRING_BYTES (XSTRING (string));
566 bufp = buf = (unsigned char *) xmalloc (bsize); 566 bufp = buf = (unsigned char *) xmalloc (bsize);
567 567
568 strp = (unsigned char *) XSTRING (string)->data; 568 strp = (unsigned char *) XSTRING (string)->data;
569 while (strp < XSTRING (string)->data + XSTRING (string)->size_byte) 569 while (strp < XSTRING (string)->data + STRING_BYTES (XSTRING (string)))
570 { 570 {
571 if (strp[0] == '\\' && strp[1] == '=') 571 if (strp[0] == '\\' && strp[1] == '=')
572 { 572 {
@@ -577,7 +577,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
577 if (multibyte) 577 if (multibyte)
578 { 578 {
579 int len; 579 int len;
580 int maxlen = XSTRING (string)->data + XSTRING (string)->size_byte - strp; 580 int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp;
581 581
582 STRING_CHAR_AND_LENGTH (strp, maxlen, len); 582 STRING_CHAR_AND_LENGTH (strp, maxlen, len);
583 if (len == 1) 583 if (len == 1)
@@ -600,7 +600,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
600 start = strp; 600 start = strp;
601 601
602 while ((strp - (unsigned char *) XSTRING (string)->data 602 while ((strp - (unsigned char *) XSTRING (string)->data
603 < XSTRING (string)->size_byte) 603 < STRING_BYTES (XSTRING (string)))
604 && *strp != ']') 604 && *strp != ']')
605 strp++; 605 strp++;
606 length_byte = strp - start; 606 length_byte = strp - start;
@@ -685,7 +685,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
685 insert_string ("\nUses keymap \""); 685 insert_string ("\nUses keymap \"");
686 insert_from_string (name, 0, 0, 686 insert_from_string (name, 0, 0,
687 XSTRING (name)->size, 687 XSTRING (name)->size,
688 XSTRING (name)->size_byte, 1); 688 STRING_BYTES (XSTRING (name)), 1);
689 insert_string ("\", which is not currently defined.\n"); 689 insert_string ("\", which is not currently defined.\n");
690 if (start[-1] == '<') keymap = Qnil; 690 if (start[-1] == '<') keymap = Qnil;
691 } 691 }
@@ -700,7 +700,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
700 subst_string: 700 subst_string:
701 start = XSTRING (tem)->data; 701 start = XSTRING (tem)->data;
702 length = XSTRING (tem)->size; 702 length = XSTRING (tem)->size;
703 length_byte = XSTRING (tem)->size_byte; 703 length_byte = STRING_BYTES (XSTRING (tem));
704 subst: 704 subst:
705 new = (unsigned char *) xrealloc (buf, bsize += length_byte); 705 new = (unsigned char *) xrealloc (buf, bsize += length_byte);
706 bufp += new - buf; 706 bufp += new - buf;
@@ -716,7 +716,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
716 else 716 else
717 { 717 {
718 int len; 718 int len;
719 int maxlen = XSTRING (string)->data + XSTRING (string)->size_byte - strp; 719 int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp;
720 720
721 STRING_CHAR_AND_LENGTH (strp, maxlen, len); 721 STRING_CHAR_AND_LENGTH (strp, maxlen, len);
722 if (len == 1) 722 if (len == 1)
diff --git a/src/fileio.c b/src/fileio.c
index 59d587ae1d4..24bf2449a2f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -375,7 +375,7 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.")
375#ifdef DOS_NT 375#ifdef DOS_NT
376 beg = strcpy (alloca (strlen (beg) + 1), beg); 376 beg = strcpy (alloca (strlen (beg) + 1), beg);
377#endif 377#endif
378 p = beg + XSTRING (filename)->size_byte; 378 p = beg + STRING_BYTES (XSTRING (filename));
379 379
380 while (p != beg && !IS_DIRECTORY_SEP (p[-1]) 380 while (p != beg && !IS_DIRECTORY_SEP (p[-1])
381#ifdef VMS 381#ifdef VMS
@@ -432,7 +432,7 @@ or the entire name if it contains no slash.")
432 return call2 (handler, Qfile_name_nondirectory, filename); 432 return call2 (handler, Qfile_name_nondirectory, filename);
433 433
434 beg = XSTRING (filename)->data; 434 beg = XSTRING (filename)->data;
435 end = p = beg + XSTRING (filename)->size_byte; 435 end = p = beg + STRING_BYTES (XSTRING (filename));
436 436
437 while (p != beg && !IS_DIRECTORY_SEP (p[-1]) 437 while (p != beg && !IS_DIRECTORY_SEP (p[-1])
438#ifdef VMS 438#ifdef VMS
@@ -585,7 +585,7 @@ On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc.")
585 if (!NILP (handler)) 585 if (!NILP (handler))
586 return call2 (handler, Qfile_name_as_directory, file); 586 return call2 (handler, Qfile_name_as_directory, file);
587 587
588 buf = (char *) alloca (XSTRING (file)->size_byte + 10); 588 buf = (char *) alloca (STRING_BYTES (XSTRING (file)) + 10);
589 return build_string (file_name_as_directory (buf, XSTRING (file)->data)); 589 return build_string (file_name_as_directory (buf, XSTRING (file)->data));
590} 590}
591 591
@@ -780,9 +780,9 @@ it returns a file name such as \"[X]Y.DIR.1\".")
780 /* 20 extra chars is insufficient for VMS, since we might perform a 780 /* 20 extra chars is insufficient for VMS, since we might perform a
781 logical name translation. an equivalence string can be up to 255 781 logical name translation. an equivalence string can be up to 255
782 chars long, so grab that much extra space... - sss */ 782 chars long, so grab that much extra space... - sss */
783 buf = (char *) alloca (XSTRING (directory)->size_byte + 20 + 255); 783 buf = (char *) alloca (STRING_BYTES (XSTRING (directory)) + 20 + 255);
784#else 784#else
785 buf = (char *) alloca (XSTRING (directory)->size_byte + 20); 785 buf = (char *) alloca (STRING_BYTES (XSTRING (directory)) + 20);
786#endif 786#endif
787 directory_file_name (XSTRING (directory)->data, buf); 787 directory_file_name (XSTRING (directory)->data, buf);
788 return build_string (buf); 788 return build_string (buf);
@@ -1805,7 +1805,7 @@ duplicates what `expand-file-name' does.")
1805 CORRECT_DIR_SEPS (nm); 1805 CORRECT_DIR_SEPS (nm);
1806 substituted = (strcmp (nm, XSTRING (filename)->data) != 0); 1806 substituted = (strcmp (nm, XSTRING (filename)->data) != 0);
1807#endif 1807#endif
1808 endp = nm + XSTRING (filename)->size_byte; 1808 endp = nm + STRING_BYTES (XSTRING (filename));
1809 1809
1810 /* If /~ or // appears, discard everything through first slash. */ 1810 /* If /~ or // appears, discard everything through first slash. */
1811 1811
@@ -1898,7 +1898,7 @@ duplicates what `expand-file-name' does.")
1898 1898
1899 /* If substitution required, recopy the string and do it */ 1899 /* If substitution required, recopy the string and do it */
1900 /* Make space in stack frame for the new copy */ 1900 /* Make space in stack frame for the new copy */
1901 xnm = (unsigned char *) alloca (XSTRING (filename)->size_byte + total + 1); 1901 xnm = (unsigned char *) alloca (STRING_BYTES (XSTRING (filename)) + total + 1);
1902 x = xnm; 1902 x = xnm;
1903 1903
1904 /* Copy the rest of the name through, replacing $ constructs with values */ 1904 /* Copy the rest of the name through, replacing $ constructs with values */
@@ -2017,7 +2017,7 @@ expand_and_dir_to_file (filename, defdir)
2017 absname = Fexpand_file_name (filename, defdir); 2017 absname = Fexpand_file_name (filename, defdir);
2018#ifdef VMS 2018#ifdef VMS
2019 { 2019 {
2020 register int c = XSTRING (absname)->data[XSTRING (absname)->size_byte - 1]; 2020 register int c = XSTRING (absname)->data[STRING_BYTES (XSTRING (absname)) - 1];
2021 if (c == ':' || c == ']' || c == '>') 2021 if (c == ':' || c == ']' || c == '>')
2022 absname = Fdirectory_file_name (absname); 2022 absname = Fdirectory_file_name (absname);
2023 } 2023 }
@@ -2025,8 +2025,8 @@ expand_and_dir_to_file (filename, defdir)
2025 /* Remove final slash, if any (unless this is the root dir). 2025 /* Remove final slash, if any (unless this is the root dir).
2026 stat behaves differently depending! */ 2026 stat behaves differently depending! */
2027 if (XSTRING (absname)->size > 1 2027 if (XSTRING (absname)->size > 1
2028 && IS_DIRECTORY_SEP (XSTRING (absname)->data[XSTRING (absname)->size_byte - 1]) 2028 && IS_DIRECTORY_SEP (XSTRING (absname)->data[STRING_BYTES (XSTRING (absname)) - 1])
2029 && !IS_DEVICE_SEP (XSTRING (absname)->data[XSTRING (absname)->size_byte-2])) 2029 && !IS_DEVICE_SEP (XSTRING (absname)->data[STRING_BYTES (XSTRING (absname))-2]))
2030 /* We cannot take shortcuts; they might be wrong for magic file names. */ 2030 /* We cannot take shortcuts; they might be wrong for magic file names. */
2031 absname = Fdirectory_file_name (absname); 2031 absname = Fdirectory_file_name (absname);
2032#endif 2032#endif
@@ -4240,7 +4240,7 @@ to the file, instead of any buffer contents, and END is ignored.")
4240 if (STRINGP (start)) 4240 if (STRINGP (start))
4241 { 4241 {
4242 failure = 0 > a_write (desc, XSTRING (start)->data, 4242 failure = 0 > a_write (desc, XSTRING (start)->data,
4243 XSTRING (start)->size_byte, 0, &annotations, 4243 STRING_BYTES (XSTRING (start)), 0, &annotations,
4244 &coding); 4244 &coding);
4245 save_errno = errno; 4245 save_errno = errno;
4246 } 4246 }
@@ -4510,7 +4510,7 @@ a_write (desc, addr, nbytes, bytepos, annot, coding)
4510 tem = Fcdr (Fcar (*annot)); 4510 tem = Fcdr (Fcar (*annot));
4511 if (STRINGP (tem)) 4511 if (STRINGP (tem))
4512 { 4512 {
4513 if (0 > e_write (desc, XSTRING (tem)->data, XSTRING (tem)->size_byte, 4513 if (0 > e_write (desc, XSTRING (tem)->data, STRING_BYTES (XSTRING (tem)),
4514 coding)) 4514 coding))
4515 return -1; 4515 return -1;
4516 } 4516 }
@@ -4793,11 +4793,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer.")
4793 if (!NILP (b->filename)) 4793 if (!NILP (b->filename))
4794 { 4794 {
4795 fwrite (XSTRING (b->filename)->data, 1, 4795 fwrite (XSTRING (b->filename)->data, 1,
4796 XSTRING (b->filename)->size_byte, stream); 4796 STRING_BYTES (XSTRING (b->filename)), stream);
4797 } 4797 }
4798 putc ('\n', stream); 4798 putc ('\n', stream);
4799 fwrite (XSTRING (b->auto_save_file_name)->data, 1, 4799 fwrite (XSTRING (b->auto_save_file_name)->data, 1,
4800 XSTRING (b->auto_save_file_name)->size_byte, stream); 4800 STRING_BYTES (XSTRING (b->auto_save_file_name)), stream);
4801 putc ('\n', stream); 4801 putc ('\n', stream);
4802 } 4802 }
4803 4803
@@ -4931,7 +4931,7 @@ double_dollars (val)
4931 register int n; 4931 register int n;
4932 int osize, count; 4932 int osize, count;
4933 4933
4934 osize = XSTRING (val)->size_byte; 4934 osize = STRING_BYTES (XSTRING (val));
4935 4935
4936 /* Count the number of $ characters. */ 4936 /* Count the number of $ characters. */
4937 for (n = osize, count = 0, old = XSTRING (val)->data; n > 0; n--) 4937 for (n = osize, count = 0, old = XSTRING (val)->data; n > 0; n--)
@@ -5072,7 +5072,7 @@ DIR defaults to current buffer's directory default.")
5072 && IS_DIRECTORY_SEP (XSTRING (dir)->data[strlen (homedir)])) 5072 && IS_DIRECTORY_SEP (XSTRING (dir)->data[strlen (homedir)]))
5073 { 5073 {
5074 dir = make_string (XSTRING (dir)->data + strlen (homedir) - 1, 5074 dir = make_string (XSTRING (dir)->data + strlen (homedir) - 1,
5075 XSTRING (dir)->size_byte - strlen (homedir) + 1); 5075 STRING_BYTES (XSTRING (dir)) - strlen (homedir) + 1);
5076 XSTRING (dir)->data[0] = '~'; 5076 XSTRING (dir)->data[0] = '~';
5077 } 5077 }
5078 5078
diff --git a/src/filelock.c b/src/filelock.c
index 116f96eacd1..b17fab1c6af 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -129,7 +129,7 @@ typedef struct
129/* Write the name of the lock file for FN into LFNAME. Length will be 129/* Write the name of the lock file for FN into LFNAME. Length will be
130 that of FN plus two more for the leading `.#' plus one for the null. */ 130 that of FN plus two more for the leading `.#' plus one for the null. */
131#define MAKE_LOCK_NAME(lock, file) \ 131#define MAKE_LOCK_NAME(lock, file) \
132 (lock = (char *) alloca (XSTRING (file)->size_byte + 2 + 1), \ 132 (lock = (char *) alloca (STRING_BYTES (XSTRING (file)) + 2 + 1), \
133 fill_in_lock_file_name (lock, (file))) 133 fill_in_lock_file_name (lock, (file)))
134 134
135static void 135static void
diff --git a/src/fns.c b/src/fns.c
index 34015c555c8..6f6694c1318 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -186,7 +186,7 @@ If STRING is a multibyte string, this is greater than the length of STRING.")
186 Lisp_Object string; 186 Lisp_Object string;
187{ 187{
188 CHECK_STRING (string, 1); 188 CHECK_STRING (string, 1);
189 return make_number (XSTRING (string)->size_byte); 189 return make_number (STRING_BYTES (XSTRING (string)));
190} 190}
191 191
192DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0, 192DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0,
@@ -204,8 +204,8 @@ Symbols are also allowed; their print names are used instead.")
204 CHECK_STRING (s2, 1); 204 CHECK_STRING (s2, 1);
205 205
206 if (XSTRING (s1)->size != XSTRING (s2)->size 206 if (XSTRING (s1)->size != XSTRING (s2)->size
207 || XSTRING (s1)->size_byte != XSTRING (s2)->size_byte 207 || STRING_BYTES (XSTRING (s1)) != STRING_BYTES (XSTRING (s2))
208 || bcmp (XSTRING (s1)->data, XSTRING (s2)->data, XSTRING (s1)->size_byte)) 208 || bcmp (XSTRING (s1)->data, XSTRING (s2)->data, STRING_BYTES (XSTRING (s1))))
209 return Qnil; 209 return Qnil;
210 return Qt; 210 return Qt;
211} 211}
@@ -488,7 +488,7 @@ concat (nargs, args, target_type, last_special)
488 if (STRING_MULTIBYTE (this)) 488 if (STRING_MULTIBYTE (this))
489 { 489 {
490 some_multibyte = 1; 490 some_multibyte = 1;
491 result_len_byte += XSTRING (this)->size_byte; 491 result_len_byte += STRING_BYTES (XSTRING (this));
492 } 492 }
493 else 493 else
494 result_len_byte += count_size_as_multibyte (XSTRING (this)->data, 494 result_len_byte += count_size_as_multibyte (XSTRING (this)->data,
@@ -542,9 +542,9 @@ concat (nargs, args, target_type, last_special)
542 if (STRINGP (this) && STRINGP (val) 542 if (STRINGP (this) && STRINGP (val)
543 && STRING_MULTIBYTE (this) == some_multibyte) 543 && STRING_MULTIBYTE (this) == some_multibyte)
544 { 544 {
545 int thislen_byte = XSTRING (this)->size_byte; 545 int thislen_byte = STRING_BYTES (XSTRING (this));
546 bcopy (XSTRING (this)->data, XSTRING (val)->data + toindex_byte, 546 bcopy (XSTRING (this)->data, XSTRING (val)->data + toindex_byte,
547 XSTRING (this)->size_byte); 547 STRING_BYTES (XSTRING (this)));
548 toindex_byte += thislen_byte; 548 toindex_byte += thislen_byte;
549 toindex += thisleni; 549 toindex += thisleni;
550 } 550 }
@@ -664,7 +664,7 @@ string_char_to_byte (string, char_index)
664 664
665 best_below = best_below_byte = 0; 665 best_below = best_below_byte = 0;
666 best_above = XSTRING (string)->size; 666 best_above = XSTRING (string)->size;
667 best_above_byte = XSTRING (string)->size_byte; 667 best_above_byte = STRING_BYTES (XSTRING (string));
668 668
669 if (EQ (string, string_char_byte_cache_string)) 669 if (EQ (string, string_char_byte_cache_string))
670 { 670 {
@@ -730,7 +730,7 @@ string_byte_to_char (string, byte_index)
730 730
731 best_below = best_below_byte = 0; 731 best_below = best_below_byte = 0;
732 best_above = XSTRING (string)->size; 732 best_above = XSTRING (string)->size;
733 best_above_byte = XSTRING (string)->size_byte; 733 best_above_byte = STRING_BYTES (XSTRING (string));
734 734
735 if (EQ (string, string_char_byte_cache_string)) 735 if (EQ (string, string_char_byte_cache_string))
736 { 736 {
@@ -798,11 +798,11 @@ string_make_multibyte (string)
798 XSTRING (string)->size); 798 XSTRING (string)->size);
799 /* If all the chars are ASCII, they won't need any more bytes 799 /* If all the chars are ASCII, they won't need any more bytes
800 once converted. In that case, we can return STRING itself. */ 800 once converted. In that case, we can return STRING itself. */
801 if (nbytes == XSTRING (string)->size_byte) 801 if (nbytes == STRING_BYTES (XSTRING (string)))
802 return string; 802 return string;
803 803
804 buf = (unsigned char *) alloca (nbytes); 804 buf = (unsigned char *) alloca (nbytes);
805 copy_text (XSTRING (string)->data, buf, XSTRING (string)->size_byte, 805 copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)),
806 0, 1); 806 0, 1);
807 807
808 return make_multibyte_string (buf, XSTRING (string)->size, nbytes); 808 return make_multibyte_string (buf, XSTRING (string)->size, nbytes);
@@ -821,7 +821,7 @@ string_make_unibyte (string)
821 821
822 buf = (unsigned char *) alloca (XSTRING (string)->size); 822 buf = (unsigned char *) alloca (XSTRING (string)->size);
823 823
824 copy_text (XSTRING (string)->data, buf, XSTRING (string)->size_byte, 824 copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)),
825 1, 0); 825 1, 0);
826 826
827 return make_unibyte_string (buf, XSTRING (string)->size); 827 return make_unibyte_string (buf, XSTRING (string)->size);
@@ -855,7 +855,7 @@ If STRING is unibyte, the result is STRING itself.")
855 if (STRING_MULTIBYTE (string)) 855 if (STRING_MULTIBYTE (string))
856 { 856 {
857 string = Fcopy_sequence (string); 857 string = Fcopy_sequence (string);
858 XSTRING (string)->size = XSTRING (string)->size_byte; 858 XSTRING (string)->size = STRING_BYTES (XSTRING (string));
859 } 859 }
860 return string; 860 return string;
861} 861}
@@ -870,9 +870,9 @@ If STRING is multibyte, the result is STRING itself.")
870 if (! STRING_MULTIBYTE (string)) 870 if (! STRING_MULTIBYTE (string))
871 { 871 {
872 int newlen = multibyte_chars_in_text (XSTRING (string)->data, 872 int newlen = multibyte_chars_in_text (XSTRING (string)->data,
873 XSTRING (string)->size_byte); 873 STRING_BYTES (XSTRING (string)));
874 /* If all the chars are ASCII, STRING is already suitable. */ 874 /* If all the chars are ASCII, STRING is already suitable. */
875 if (newlen != XSTRING (string)->size_byte) 875 if (newlen != STRING_BYTES (XSTRING (string)))
876 { 876 {
877 string = Fcopy_sequence (string); 877 string = Fcopy_sequence (string);
878 XSTRING (string)->size = newlen; 878 XSTRING (string)->size = newlen;
@@ -932,7 +932,7 @@ This function allows vectors as well as strings.")
932 if (STRINGP (string)) 932 if (STRINGP (string))
933 { 933 {
934 size = XSTRING (string)->size; 934 size = XSTRING (string)->size;
935 size_byte = XSTRING (string)->size_byte; 935 size_byte = STRING_BYTES (XSTRING (string));
936 } 936 }
937 else 937 else
938 size = XVECTOR (string)->size; 938 size = XVECTOR (string)->size;
@@ -996,7 +996,7 @@ substring_both (string, from, from_byte, to, to_byte)
996 if (STRINGP (string)) 996 if (STRINGP (string))
997 { 997 {
998 size = XSTRING (string)->size; 998 size = XSTRING (string)->size;
999 size_byte = XSTRING (string)->size_byte; 999 size_byte = STRING_BYTES (XSTRING (string));
1000 } 1000 }
1001 else 1001 else
1002 size = XVECTOR (string)->size; 1002 size = XVECTOR (string)->size;
@@ -1587,10 +1587,10 @@ internal_equal (o1, o2, depth)
1587 case Lisp_String: 1587 case Lisp_String:
1588 if (XSTRING (o1)->size != XSTRING (o2)->size) 1588 if (XSTRING (o1)->size != XSTRING (o2)->size)
1589 return 0; 1589 return 0;
1590 if (XSTRING (o1)->size_byte != XSTRING (o2)->size_byte) 1590 if (STRING_BYTES (XSTRING (o1)) != STRING_BYTES (XSTRING (o2)))
1591 return 0; 1591 return 0;
1592 if (bcmp (XSTRING (o1)->data, XSTRING (o2)->data, 1592 if (bcmp (XSTRING (o1)->data, XSTRING (o2)->data,
1593 XSTRING (o1)->size_byte)) 1593 STRING_BYTES (XSTRING (o1))))
1594 return 0; 1594 return 0;
1595 return 1; 1595 return 1;
1596 } 1596 }
@@ -2075,7 +2075,7 @@ mapcar1 (leni, vals, fn, seq)
2075 else if (STRINGP (seq)) 2075 else if (STRINGP (seq))
2076 { 2076 {
2077 /* Multi-byte string. */ 2077 /* Multi-byte string. */
2078 int len_byte = XSTRING (seq)->size_byte; 2078 int len_byte = STRING_BYTES (XSTRING (seq));
2079 int i_byte; 2079 int i_byte;
2080 2080
2081 for (i = 0, i_byte = 0; i < leni;) 2081 for (i = 0, i_byte = 0; i < leni;)
diff --git a/src/frame.c b/src/frame.c
index 63f4e9f16ed..e66cabdb7a7 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1794,7 +1794,7 @@ set_term_frame_name (f, name)
1794 /* Check for no change needed in this very common case 1794 /* Check for no change needed in this very common case
1795 before we do any consing. */ 1795 before we do any consing. */
1796 if (frame_name_fnn_p (XSTRING (f->name)->data, 1796 if (frame_name_fnn_p (XSTRING (f->name)->data,
1797 XSTRING (f->name)->size_byte)) 1797 STRING_BYTES (XSTRING (f->name))))
1798 return; 1798 return;
1799 1799
1800 terminal_frame_count++; 1800 terminal_frame_count++;
@@ -1811,7 +1811,7 @@ set_term_frame_name (f, name)
1811 1811
1812 /* Don't allow the user to set the frame name to F<num>, so it 1812 /* Don't allow the user to set the frame name to F<num>, so it
1813 doesn't clash with the names we generate for terminal frames. */ 1813 doesn't clash with the names we generate for terminal frames. */
1814 if (frame_name_fnn_p (XSTRING (name)->data, XSTRING (name)->size_byte)) 1814 if (frame_name_fnn_p (XSTRING (name)->data, STRING_BYTES (XSTRING (name))))
1815 error ("Frame names of the form F<num> are usurped by Emacs"); 1815 error ("Frame names of the form F<num> are usurped by Emacs");
1816 } 1816 }
1817 1817
diff --git a/src/insdel.c b/src/insdel.c
index e2223f1b4f7..55f8b61e868 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1189,7 +1189,7 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes,
1189 intervals = XSTRING (string)->intervals; 1189 intervals = XSTRING (string)->intervals;
1190 /* Get the intervals for the part of the string we are inserting-- 1190 /* Get the intervals for the part of the string we are inserting--
1191 not including the combined-before bytes. */ 1191 not including the combined-before bytes. */
1192 if (nbytes < XSTRING (string)->size_byte) 1192 if (nbytes < STRING_BYTES (XSTRING (string)))
1193 intervals = copy_intervals (intervals, pos, nchars); 1193 intervals = copy_intervals (intervals, pos, nchars);
1194 1194
1195 /* Insert those intervals. */ 1195 /* Insert those intervals. */
@@ -1497,7 +1497,7 @@ replace_range (from, to, new, prepare, inherit, nomarkers)
1497 int from, to, prepare, inherit, nomarkers; 1497 int from, to, prepare, inherit, nomarkers;
1498{ 1498{
1499 int inschars = XSTRING (new)->size; 1499 int inschars = XSTRING (new)->size;
1500 int insbytes = XSTRING (new)->size_byte; 1500 int insbytes = STRING_BYTES (XSTRING (new));
1501 int from_byte, to_byte; 1501 int from_byte, to_byte;
1502 int nbytes_del, nchars_del; 1502 int nbytes_del, nchars_del;
1503 register Lisp_Object temp; 1503 register Lisp_Object temp;
diff --git a/src/keyboard.c b/src/keyboard.c
index 6bb2b0c3627..fb3d8bae1ed 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -617,11 +617,11 @@ echo_char (c)
617 else if (SYMBOLP (c)) 617 else if (SYMBOLP (c))
618 { 618 {
619 struct Lisp_String *name = XSYMBOL (c)->name; 619 struct Lisp_String *name = XSYMBOL (c)->name;
620 if ((ptr - current_kboard->echobuf) + name->size_byte + 4 620 if ((ptr - current_kboard->echobuf) + STRING_BYTES (name) + 4
621 > ECHOBUFSIZE) 621 > ECHOBUFSIZE)
622 return; 622 return;
623 bcopy (name->data, ptr, name->size_byte); 623 bcopy (name->data, ptr, STRING_BYTES (name));
624 ptr += name->size_byte; 624 ptr += STRING_BYTES (name);
625 } 625 }
626 626
627 if (current_kboard->echoptr == current_kboard->echobuf 627 if (current_kboard->echoptr == current_kboard->echobuf
@@ -2378,7 +2378,7 @@ record_char (c)
2378 { 2378 {
2379 putc ('<', dribble); 2379 putc ('<', dribble);
2380 fwrite (XSYMBOL (dribblee)->name->data, sizeof (char), 2380 fwrite (XSYMBOL (dribblee)->name->data, sizeof (char),
2381 XSYMBOL (dribblee)->name->size_byte, 2381 STRING_BYTES (XSYMBOL (dribblee)->name),
2382 dribble); 2382 dribble);
2383 putc ('>', dribble); 2383 putc ('>', dribble);
2384 } 2384 }
@@ -4340,7 +4340,7 @@ parse_modifiers_uncached (symbol, modifier_end)
4340 modifiers = 0; 4340 modifiers = 0;
4341 name = XSYMBOL (symbol)->name; 4341 name = XSYMBOL (symbol)->name;
4342 4342
4343 for (i = 0; i+2 <= name->size_byte; ) 4343 for (i = 0; i+2 <= STRING_BYTES (name); )
4344 { 4344 {
4345 int this_mod_end = 0; 4345 int this_mod_end = 0;
4346 int this_mod = 0; 4346 int this_mod = 0;
@@ -4387,7 +4387,8 @@ parse_modifiers_uncached (symbol, modifier_end)
4387 4387
4388 /* Check there is a dash after the modifier, so that it 4388 /* Check there is a dash after the modifier, so that it
4389 really is a modifier. */ 4389 really is a modifier. */
4390 if (this_mod_end >= name->size_byte || name->data[this_mod_end] != '-') 4390 if (this_mod_end >= STRING_BYTES (name)
4391 || name->data[this_mod_end] != '-')
4391 break; 4392 break;
4392 4393
4393 /* This modifier is real; look for another. */ 4394 /* This modifier is real; look for another. */
@@ -4398,7 +4399,7 @@ parse_modifiers_uncached (symbol, modifier_end)
4398 /* Should we include the `click' modifier? */ 4399 /* Should we include the `click' modifier? */
4399 if (! (modifiers & (down_modifier | drag_modifier 4400 if (! (modifiers & (down_modifier | drag_modifier
4400 | double_modifier | triple_modifier)) 4401 | double_modifier | triple_modifier))
4401 && i + 7 == name->size_byte 4402 && i + 7 == STRING_BYTES (name)
4402 && strncmp (name->data + i, "mouse-", 6) == 0 4403 && strncmp (name->data + i, "mouse-", 6) == 0
4403 && ('0' <= name->data[i + 6] && name->data[i + 6] <= '9')) 4404 && ('0' <= name->data[i + 6] && name->data[i + 6] <= '9'))
4404 modifiers |= click_modifier; 4405 modifiers |= click_modifier;
@@ -4515,7 +4516,7 @@ parse_modifiers (symbol)
4515 Lisp_Object mask; 4516 Lisp_Object mask;
4516 4517
4517 unmodified = Fintern (make_string (XSYMBOL (symbol)->name->data + end, 4518 unmodified = Fintern (make_string (XSYMBOL (symbol)->name->data + end,
4518 XSYMBOL (symbol)->name->size_byte - end), 4519 STRING_BYTES (XSYMBOL (symbol)->name) - end),
4519 Qnil); 4520 Qnil);
4520 4521
4521 if (modifiers & ~(((EMACS_INT)1 << VALBITS) - 1)) 4522 if (modifiers & ~(((EMACS_INT)1 << VALBITS) - 1))
@@ -4570,7 +4571,7 @@ apply_modifiers (modifiers, base)
4570 new_symbol = apply_modifiers_uncached (modifiers, 4571 new_symbol = apply_modifiers_uncached (modifiers,
4571 XSYMBOL (base)->name->data, 4572 XSYMBOL (base)->name->data,
4572 XSYMBOL (base)->name->size, 4573 XSYMBOL (base)->name->size,
4573 XSYMBOL (base)->name->size_byte); 4574 STRING_BYTES (XSYMBOL (base)->name));
4574 4575
4575 /* Add the new symbol to the base's cache. */ 4576 /* Add the new symbol to the base's cache. */
4576 entry = Fcons (index, new_symbol); 4577 entry = Fcons (index, new_symbol);
@@ -4818,11 +4819,11 @@ parse_solitary_modifier (symbol)
4818 switch (name->data[0]) 4819 switch (name->data[0])
4819 { 4820 {
4820#define SINGLE_LETTER_MOD(BIT) \ 4821#define SINGLE_LETTER_MOD(BIT) \
4821 if (name->size_byte == 1) \ 4822 if (STRING_BYTES (name) == 1) \
4822 return BIT; 4823 return BIT;
4823 4824
4824#define MULTI_LETTER_MOD(BIT, NAME, LEN) \ 4825#define MULTI_LETTER_MOD(BIT, NAME, LEN) \
4825 if (LEN == name->size_byte \ 4826 if (LEN == STRING_BYTES (name) \
4826 && ! strncmp (name->data, NAME, LEN)) \ 4827 && ! strncmp (name->data, NAME, LEN)) \
4827 return BIT; 4828 return BIT;
4828 4829
@@ -5989,7 +5990,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
5989 5990
5990 /* Prompt string always starts with map's prompt, and a space. */ 5991 /* Prompt string always starts with map's prompt, and a space. */
5991 strcpy (menu, XSTRING (name)->data); 5992 strcpy (menu, XSTRING (name)->data);
5992 nlength = XSTRING (name)->size_byte; 5993 nlength = STRING_BYTES (XSTRING (name));
5993 menu[nlength++] = ':'; 5994 menu[nlength++] = ':';
5994 menu[nlength++] = ' '; 5995 menu[nlength++] = ' ';
5995 menu[nlength] = 0; 5996 menu[nlength] = 0;
@@ -7608,7 +7609,7 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
7608 7609
7609 newmessage 7610 newmessage
7610 = (char *) alloca (XSYMBOL (function)->name->size 7611 = (char *) alloca (XSYMBOL (function)->name->size
7611 + XSTRING (binding)->size_byte 7612 + STRING_BYTES (XSTRING (binding))
7612 + 100); 7613 + 100);
7613 sprintf (newmessage, "You can run the command `%s' with %s", 7614 sprintf (newmessage, "You can run the command `%s' with %s",
7614 XSYMBOL (function)->name->data, 7615 XSYMBOL (function)->name->data,
@@ -7928,7 +7929,7 @@ stuff_buffered_input (stuffstring)
7928 register int count; 7929 register int count;
7929 7930
7930 p = XSTRING (stuffstring)->data; 7931 p = XSTRING (stuffstring)->data;
7931 count = XSTRING (stuffstring)->size_byte; 7932 count = STRING_BYTES (XSTRING (stuffstring));
7932 while (count-- > 0) 7933 while (count-- > 0)
7933 stuff_char (*p++); 7934 stuff_char (*p++);
7934 stuff_char ('\n'); 7935 stuff_char ('\n');
diff --git a/src/keymap.c b/src/keymap.c
index c757f1d31f5..7467b49ace0 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -3026,7 +3026,7 @@ describe_vector (vector, elt_prefix, elt_describer,
3026 tem2 = CHARSET_TABLE_INFO (i - 128, CHARSET_SHORT_NAME_IDX); 3026 tem2 = CHARSET_TABLE_INFO (i - 128, CHARSET_SHORT_NAME_IDX);
3027 if (STRINGP (tem2)) 3027 if (STRINGP (tem2))
3028 insert_from_string (tem2, 0, 0, XSTRING (tem2)->size, 3028 insert_from_string (tem2, 0, 0, XSTRING (tem2)->size,
3029 XSTRING (tem2)->size_byte, 0); 3029 STRING_BYTES (XSTRING (tem2)), 0);
3030 else 3030 else
3031 insert ("?", 1); 3031 insert ("?", 1);
3032 insert (">", 1); 3032 insert (">", 1);
diff --git a/src/lread.c b/src/lread.c
index 0d04bc0c814..cfaa8ec4f25 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1157,12 +1157,12 @@ START and END optionally delimit a substring of STRING from which to read;\n\
1157 CHECK_STRING (string,0); 1157 CHECK_STRING (string,0);
1158 1158
1159 if (NILP (end)) 1159 if (NILP (end))
1160 endval = XSTRING (string)->size_byte; 1160 endval = STRING_BYTES (XSTRING (string));
1161 else 1161 else
1162 { 1162 {
1163 CHECK_NUMBER (end, 2); 1163 CHECK_NUMBER (end, 2);
1164 endval = string_char_to_byte (string, XINT (end)); 1164 endval = string_char_to_byte (string, XINT (end));
1165 if (endval < 0 || endval > XSTRING (string)->size_byte) 1165 if (endval < 0 || endval > STRING_BYTES (XSTRING (string)))
1166 args_out_of_range (string, end); 1166 args_out_of_range (string, end);
1167 } 1167 }
1168 1168
@@ -2255,7 +2255,7 @@ it defaults to the value of `obarray'.")
2255 2255
2256 tem = oblookup (obarray, XSTRING (string)->data, 2256 tem = oblookup (obarray, XSTRING (string)->data,
2257 XSTRING (string)->size, 2257 XSTRING (string)->size,
2258 XSTRING (string)->size_byte); 2258 STRING_BYTES (XSTRING (string)));
2259 if (!INTEGERP (tem)) 2259 if (!INTEGERP (tem))
2260 return tem; 2260 return tem;
2261 2261
@@ -2292,7 +2292,7 @@ it defaults to the value of `obarray'.")
2292 2292
2293 tem = oblookup (obarray, XSTRING (string)->data, 2293 tem = oblookup (obarray, XSTRING (string)->data,
2294 XSTRING (string)->size, 2294 XSTRING (string)->size,
2295 XSTRING (string)->size_byte); 2295 STRING_BYTES (XSTRING (string)));
2296 if (!INTEGERP (tem)) 2296 if (!INTEGERP (tem))
2297 return tem; 2297 return tem;
2298 return Qnil; 2298 return Qnil;
@@ -2323,7 +2323,7 @@ OBARRAY defaults to the value of the variable `obarray'.")
2323 2323
2324 tem = oblookup (obarray, XSTRING (string)->data, 2324 tem = oblookup (obarray, XSTRING (string)->data,
2325 XSTRING (string)->size, 2325 XSTRING (string)->size,
2326 XSTRING (string)->size_byte); 2326 STRING_BYTES (XSTRING (string)));
2327 if (INTEGERP (tem)) 2327 if (INTEGERP (tem))
2328 return Qnil; 2328 return Qnil;
2329 /* If arg was a symbol, don't delete anything but that symbol itself. */ 2329 /* If arg was a symbol, don't delete anything but that symbol itself. */
@@ -2398,7 +2398,7 @@ oblookup (obarray, ptr, size, size_byte)
2398 else 2398 else
2399 for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next)) 2399 for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next))
2400 { 2400 {
2401 if (XSYMBOL (tail)->name->size_byte == size_byte 2401 if (STRING_BYTES (XSYMBOL (tail)->name) == size_byte
2402 && XSYMBOL (tail)->name->size == size 2402 && XSYMBOL (tail)->name->size == size
2403 && !bcmp (XSYMBOL (tail)->name->data, ptr, size_byte)) 2403 && !bcmp (XSYMBOL (tail)->name->data, ptr, size_byte))
2404 return tail; 2404 return tail;
diff --git a/src/minibuf.c b/src/minibuf.c
index 3eb1adc2c7b..124d8eb8cc7 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -480,7 +480,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
480 /* Ignore trailing whitespace; any other trailing junk is an error. */ 480 /* Ignore trailing whitespace; any other trailing junk is an error. */
481 int i; 481 int i;
482 pos = string_char_to_byte (val, pos); 482 pos = string_char_to_byte (val, pos);
483 for (i = pos; i < XSTRING (val)->size_byte; i++) 483 for (i = pos; i < STRING_BYTES (XSTRING (val)); i++)
484 { 484 {
485 int c = XSTRING (val)->data[i]; 485 int c = XSTRING (val)->data[i];
486 if (c != ' ' && c != '\t' && c != '\n') 486 if (c != ' ' && c != '\t' && c != '\n')
@@ -954,9 +954,9 @@ or the symbol from the obarray.")
954 /* Is this element a possible completion? */ 954 /* Is this element a possible completion? */
955 955
956 if (STRINGP (eltstring) 956 if (STRINGP (eltstring)
957 && XSTRING (string)->size_byte <= XSTRING (eltstring)->size_byte 957 && STRING_BYTES (XSTRING (string)) <= STRING_BYTES (XSTRING (eltstring))
958 && 0 > scmp (XSTRING (eltstring)->data, XSTRING (string)->data, 958 && 0 > scmp (XSTRING (eltstring)->data, XSTRING (string)->data,
959 XSTRING (string)->size_byte)) 959 STRING_BYTES (XSTRING (string))))
960 { 960 {
961 /* Yes. */ 961 /* Yes. */
962 Lisp_Object regexps; 962 Lisp_Object regexps;
@@ -996,11 +996,11 @@ or the symbol from the obarray.")
996 if (NILP (bestmatch)) 996 if (NILP (bestmatch))
997 { 997 {
998 bestmatch = eltstring; 998 bestmatch = eltstring;
999 bestmatchsize = XSTRING (eltstring)->size_byte; 999 bestmatchsize = STRING_BYTES (XSTRING (eltstring));
1000 } 1000 }
1001 else 1001 else
1002 { 1002 {
1003 compare = min (bestmatchsize, XSTRING (eltstring)->size_byte); 1003 compare = min (bestmatchsize, STRING_BYTES (XSTRING (eltstring)));
1004 matchsize = scmp (XSTRING (bestmatch)->data, 1004 matchsize = scmp (XSTRING (bestmatch)->data,
1005 XSTRING (eltstring)->data, 1005 XSTRING (eltstring)->data,
1006 compare); 1006 compare);
@@ -1012,8 +1012,8 @@ or the symbol from the obarray.")
1012 use it as the best match rather than one that is not an 1012 use it as the best match rather than one that is not an
1013 exact match. This way, we get the case pattern 1013 exact match. This way, we get the case pattern
1014 of the actual match. */ 1014 of the actual match. */
1015 if ((matchsize == XSTRING (eltstring)->size_byte 1015 if ((matchsize == STRING_BYTES (XSTRING (eltstring))
1016 && matchsize < XSTRING (bestmatch)->size_byte) 1016 && matchsize < STRING_BYTES (XSTRING (bestmatch)))
1017 || 1017 ||
1018 /* If there is more than one exact match ignoring case, 1018 /* If there is more than one exact match ignoring case,
1019 and one of them is exact including case, 1019 and one of them is exact including case,
@@ -1021,15 +1021,15 @@ or the symbol from the obarray.")
1021 /* If there is no exact match ignoring case, 1021 /* If there is no exact match ignoring case,
1022 prefer a match that does not change the case 1022 prefer a match that does not change the case
1023 of the input. */ 1023 of the input. */
1024 ((matchsize == XSTRING (eltstring)->size_byte) 1024 ((matchsize == STRING_BYTES (XSTRING (eltstring)))
1025 == 1025 ==
1026 (matchsize == XSTRING (bestmatch)->size_byte) 1026 (matchsize == STRING_BYTES (XSTRING (bestmatch)))
1027 && !bcmp (XSTRING (eltstring)->data, 1027 && !bcmp (XSTRING (eltstring)->data,
1028 XSTRING (string)->data, 1028 XSTRING (string)->data,
1029 XSTRING (string)->size_byte) 1029 STRING_BYTES (XSTRING (string)))
1030 && bcmp (XSTRING (bestmatch)->data, 1030 && bcmp (XSTRING (bestmatch)->data,
1031 XSTRING (string)->data, 1031 XSTRING (string)->data,
1032 XSTRING (string)->size_byte))) 1032 STRING_BYTES (XSTRING (string)))))
1033 bestmatch = eltstring; 1033 bestmatch = eltstring;
1034 } 1034 }
1035 bestmatchsize = matchsize; 1035 bestmatchsize = matchsize;
@@ -1042,13 +1042,13 @@ or the symbol from the obarray.")
1042 /* If we are ignoring case, and there is no exact match, 1042 /* If we are ignoring case, and there is no exact match,
1043 and no additional text was supplied, 1043 and no additional text was supplied,
1044 don't change the case of what the user typed. */ 1044 don't change the case of what the user typed. */
1045 if (completion_ignore_case && bestmatchsize == XSTRING (string)->size_byte 1045 if (completion_ignore_case && bestmatchsize == STRING_BYTES (XSTRING (string))
1046 && XSTRING (bestmatch)->size_byte > bestmatchsize) 1046 && STRING_BYTES (XSTRING (bestmatch)) > bestmatchsize)
1047 return string; 1047 return string;
1048 1048
1049 /* Return t if the supplied string is an exact match (counting case); 1049 /* Return t if the supplied string is an exact match (counting case);
1050 it does not require any change to be made. */ 1050 it does not require any change to be made. */
1051 if (matchcount == 1 && bestmatchsize == XSTRING (string)->size_byte 1051 if (matchcount == 1 && bestmatchsize == STRING_BYTES (XSTRING (string))
1052 && !bcmp (XSTRING (bestmatch)->data, XSTRING (string)->data, 1052 && !bcmp (XSTRING (bestmatch)->data, XSTRING (string)->data,
1053 bestmatchsize)) 1053 bestmatchsize))
1054 return Qt; 1054 return Qt;
@@ -1182,15 +1182,15 @@ are ignored unless STRING itself starts with a space.")
1182 /* Is this element a possible completion? */ 1182 /* Is this element a possible completion? */
1183 1183
1184 if (STRINGP (eltstring) 1184 if (STRINGP (eltstring)
1185 && XSTRING (string)->size_byte <= XSTRING (eltstring)->size_byte 1185 && STRING_BYTES (XSTRING (string)) <= STRING_BYTES (XSTRING (eltstring))
1186 /* If HIDE_SPACES, reject alternatives that start with space 1186 /* If HIDE_SPACES, reject alternatives that start with space
1187 unless the input starts with space. */ 1187 unless the input starts with space. */
1188 && ((XSTRING (string)->size_byte > 0 1188 && ((STRING_BYTES (XSTRING (string)) > 0
1189 && XSTRING (string)->data[0] == ' ') 1189 && XSTRING (string)->data[0] == ' ')
1190 || XSTRING (eltstring)->data[0] != ' ' 1190 || XSTRING (eltstring)->data[0] != ' '
1191 || NILP (hide_spaces)) 1191 || NILP (hide_spaces))
1192 && 0 > scmp (XSTRING (eltstring)->data, XSTRING (string)->data, 1192 && 0 > scmp (XSTRING (eltstring)->data, XSTRING (string)->data,
1193 XSTRING (string)->size_byte)) 1193 STRING_BYTES (XSTRING (string))))
1194 { 1194 {
1195 /* Yes. */ 1195 /* Yes. */
1196 Lisp_Object regexps; 1196 Lisp_Object regexps;
@@ -1356,7 +1356,7 @@ test_completion (txt)
1356 tem = oblookup (Vminibuffer_completion_table, 1356 tem = oblookup (Vminibuffer_completion_table,
1357 XSTRING (txt)->data, 1357 XSTRING (txt)->data,
1358 XSTRING (txt)->size, 1358 XSTRING (txt)->size,
1359 XSTRING (txt)->size_byte); 1359 STRING_BYTES (XSTRING (txt)));
1360 if (!SYMBOLP (tem)) 1360 if (!SYMBOLP (tem))
1361 return Qnil; 1361 return Qnil;
1362 else if (!NILP (Vminibuffer_completion_predicate)) 1362 else if (!NILP (Vminibuffer_completion_predicate))
@@ -1658,13 +1658,13 @@ Return nil if there is no valid completion, else t.")
1658 tem = substituted; 1658 tem = substituted;
1659 Ferase_buffer (); 1659 Ferase_buffer ();
1660 insert_from_string (tem, 0, 0, XSTRING (tem)->size, 1660 insert_from_string (tem, 0, 0, XSTRING (tem)->size,
1661 XSTRING (tem)->size_byte, 0); 1661 STRING_BYTES (XSTRING (tem)), 0);
1662 } 1662 }
1663 } 1663 }
1664 buffer_string = XSTRING (tem)->data; 1664 buffer_string = XSTRING (tem)->data;
1665 completion_string = XSTRING (completion)->data; 1665 completion_string = XSTRING (completion)->data;
1666 buffer_nbytes = XSTRING (tem)->size_byte; /* ie ZV_BYTE - BEGV_BYTE */ 1666 buffer_nbytes = STRING_BYTES (XSTRING (tem)); /* ie ZV_BYTE - BEGV_BYTE */
1667 completion_nbytes = XSTRING (completion)->size_byte; 1667 completion_nbytes = STRING_BYTES (XSTRING (completion));
1668 i_byte = buffer_nbytes - completion_nbytes; 1668 i_byte = buffer_nbytes - completion_nbytes;
1669 if (i_byte > 0 || 1669 if (i_byte > 0 ||
1670 0 <= scmp (buffer_string, completion_string, buffer_nbytes)) 1670 0 <= scmp (buffer_string, completion_string, buffer_nbytes))
@@ -1716,7 +1716,7 @@ Return nil if there is no valid completion, else t.")
1716 int len, c; 1716 int len, c;
1717 1717
1718 completion_string = XSTRING (completion)->data; 1718 completion_string = XSTRING (completion)->data;
1719 for (; i_byte < XSTRING (completion)->size_byte; i_byte += len, i++) 1719 for (; i_byte < STRING_BYTES (XSTRING (completion)); i_byte += len, i++)
1720 { 1720 {
1721 c = STRING_CHAR_AND_LENGTH (completion_string + i_byte, 1721 c = STRING_CHAR_AND_LENGTH (completion_string + i_byte,
1722 XSTRING (completion)->size - i_byte, 1722 XSTRING (completion)->size - i_byte,
diff --git a/src/print.c b/src/print.c
index 9484b927970..264659288c5 100644
--- a/src/print.c
+++ b/src/print.c
@@ -536,7 +536,7 @@ print_string (string, printcharfun)
536 /* strout is safe for output to a frame (echo area) or to print_buffer. */ 536 /* strout is safe for output to a frame (echo area) or to print_buffer. */
537 strout (XSTRING (string)->data, 537 strout (XSTRING (string)->data,
538 XSTRING (string)->size, 538 XSTRING (string)->size,
539 XSTRING (string)->size_byte, 539 STRING_BYTES (XSTRING (string)),
540 printcharfun, STRING_MULTIBYTE (string)); 540 printcharfun, STRING_MULTIBYTE (string));
541 else 541 else
542 { 542 {
@@ -544,7 +544,7 @@ print_string (string, printcharfun)
544 So re-fetch the string address for each character. */ 544 So re-fetch the string address for each character. */
545 int i; 545 int i;
546 int size = XSTRING (string)->size; 546 int size = XSTRING (string)->size;
547 int size_byte = XSTRING (string)->size_byte; 547 int size_byte = STRING_BYTES (XSTRING (string));
548 struct gcpro gcpro1; 548 struct gcpro gcpro1;
549 GCPRO1 (string); 549 GCPRO1 (string);
550 if (size == size_byte) 550 if (size == size_byte)
@@ -1162,7 +1162,7 @@ print (obj, printcharfun, escapeflag)
1162#endif 1162#endif
1163 1163
1164 PRINTCHAR ('\"'); 1164 PRINTCHAR ('\"');
1165 size_byte = XSTRING (obj)->size_byte; 1165 size_byte = STRING_BYTES (XSTRING (obj));
1166 1166
1167 for (i = 0, i_byte = 0; i_byte < size_byte;) 1167 for (i = 0, i_byte = 0; i_byte < size_byte;)
1168 { 1168 {
@@ -1234,7 +1234,7 @@ print (obj, printcharfun, escapeflag)
1234 { 1234 {
1235 register int confusing; 1235 register int confusing;
1236 register unsigned char *p = XSYMBOL (obj)->name->data; 1236 register unsigned char *p = XSYMBOL (obj)->name->data;
1237 register unsigned char *end = p + XSYMBOL (obj)->name->size_byte; 1237 register unsigned char *end = p + STRING_BYTES (XSYMBOL (obj)->name);
1238 register int c; 1238 register int c;
1239 int i, i_byte, size_byte; 1239 int i, i_byte, size_byte;
1240 Lisp_Object name; 1240 Lisp_Object name;
@@ -1296,7 +1296,7 @@ print (obj, printcharfun, escapeflag)
1296 PRINTCHAR (':'); 1296 PRINTCHAR (':');
1297 } 1297 }
1298 1298
1299 size_byte = XSTRING (name)->size_byte; 1299 size_byte = STRING_BYTES (XSTRING (name));
1300 1300
1301 for (i = 0, i_byte = 0; i_byte < size_byte;) 1301 for (i = 0, i_byte = 0; i_byte < size_byte;)
1302 { 1302 {
diff --git a/src/process.c b/src/process.c
index 5c5b71e6954..05c12d10ab6 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1089,12 +1089,12 @@ Remaining arguments are strings to give program as arguments.")
1089#ifdef VMS 1089#ifdef VMS
1090 /* Make a one member argv with all args concatenated 1090 /* Make a one member argv with all args concatenated
1091 together separated by a blank. */ 1091 together separated by a blank. */
1092 len = XSTRING (program)->size_byte + 2; 1092 len = STRING_BYTES (XSTRING (program)) + 2;
1093 for (i = 3; i < nargs; i++) 1093 for (i = 3; i < nargs; i++)
1094 { 1094 {
1095 tem = args[i]; 1095 tem = args[i];
1096 CHECK_STRING (tem, i); 1096 CHECK_STRING (tem, i);
1097 len += XSTRING (tem)->size_byte + 1; /* count the blank */ 1097 len += STRING_BYTES (XSTRING (tem)) + 1; /* count the blank */
1098 } 1098 }
1099 new_argv = (unsigned char *) alloca (len); 1099 new_argv = (unsigned char *) alloca (len);
1100 strcpy (new_argv, XSTRING (program)->data); 1100 strcpy (new_argv, XSTRING (program)->data);
@@ -2756,7 +2756,7 @@ read_process_output (proc, channel)
2756 char *buf = (char *) xmalloc (nbytes + carryover); 2756 char *buf = (char *) xmalloc (nbytes + carryover);
2757 2757
2758 bcopy (XSTRING (p->decoding_buf)->data 2758 bcopy (XSTRING (p->decoding_buf)->data
2759 + XSTRING (p->decoding_buf)->size_byte - carryover, 2759 + STRING_BYTES (XSTRING (p->decoding_buf)) - carryover,
2760 buf, carryover); 2760 buf, carryover);
2761 bcopy (chars, buf + carryover, nbytes); 2761 bcopy (chars, buf + carryover, nbytes);
2762 chars = buf; 2762 chars = buf;
@@ -2767,7 +2767,7 @@ read_process_output (proc, channel)
2767 if (carryover) 2767 if (carryover)
2768 /* See the comment above. */ 2768 /* See the comment above. */
2769 bcopy (XSTRING (p->decoding_buf)->data 2769 bcopy (XSTRING (p->decoding_buf)->data
2770 + XSTRING (p->decoding_buf)->size_byte - carryover, 2770 + STRING_BYTES (XSTRING (p->decoding_buf)) - carryover,
2771 buf, carryover); 2771 buf, carryover);
2772 2772
2773 if (proc_buffered_char[channel] < 0) 2773 if (proc_buffered_char[channel] < 0)
@@ -2799,10 +2799,10 @@ read_process_output (proc, channel)
2799 int require = decoding_buffer_size (coding, nbytes); 2799 int require = decoding_buffer_size (coding, nbytes);
2800 int result; 2800 int result;
2801 2801
2802 if (XSTRING (p->decoding_buf)->size_byte < require) 2802 if (STRING_BYTES (XSTRING (p->decoding_buf)) < require)
2803 p->decoding_buf = make_uninit_string (require); 2803 p->decoding_buf = make_uninit_string (require);
2804 result = decode_coding (coding, chars, XSTRING (p->decoding_buf)->data, 2804 result = decode_coding (coding, chars, XSTRING (p->decoding_buf)->data,
2805 nbytes, XSTRING (p->decoding_buf)->size_byte); 2805 nbytes, STRING_BYTES (XSTRING (p->decoding_buf)));
2806 carryover = nbytes - coding->consumed; 2806 carryover = nbytes - coding->consumed;
2807 2807
2808 /* A new coding system might be found by `decode_coding'. */ 2808 /* A new coding system might be found by `decode_coding'. */
@@ -3111,7 +3111,7 @@ send_process (proc, buf, len, object)
3111 offset = -1; 3111 offset = -1;
3112 } 3112 }
3113 bcopy ((XSTRING (XPROCESS (proc)->encoding_buf)->data 3113 bcopy ((XSTRING (XPROCESS (proc)->encoding_buf)->data
3114 + XSTRING (XPROCESS (proc)->encoding_buf)->size_byte 3114 + STRING_BYTES (XSTRING (XPROCESS (proc)->encoding_buf))
3115 - carryover), 3115 - carryover),
3116 temp_buf, 3116 temp_buf,
3117 carryover); 3117 carryover);
@@ -3119,7 +3119,7 @@ send_process (proc, buf, len, object)
3119 buf = temp_buf; 3119 buf = temp_buf;
3120 } 3120 }
3121 3121
3122 if (XSTRING (XPROCESS (proc)->encoding_buf)->size_byte < require) 3122 if (STRING_BYTES (XSTRING (XPROCESS (proc)->encoding_buf)) < require)
3123 { 3123 {
3124 XPROCESS (proc)->encoding_buf = make_uninit_string (require); 3124 XPROCESS (proc)->encoding_buf = make_uninit_string (require);
3125 3125
@@ -3133,7 +3133,7 @@ send_process (proc, buf, len, object)
3133 } 3133 }
3134 object = XPROCESS (proc)->encoding_buf; 3134 object = XPROCESS (proc)->encoding_buf;
3135 encode_coding (coding, buf, XSTRING (object)->data, 3135 encode_coding (coding, buf, XSTRING (object)->data,
3136 len, XSTRING (object)->size_byte); 3136 len, STRING_BYTES (XSTRING (object)));
3137 len = coding->produced; 3137 len = coding->produced;
3138 buf = XSTRING (object)->data; 3138 buf = XSTRING (object)->data;
3139 if (temp_buf) 3139 if (temp_buf)
@@ -3318,7 +3318,7 @@ Output from processes can arrive in between bunches.")
3318 CHECK_STRING (string, 1); 3318 CHECK_STRING (string, 1);
3319 proc = get_process (process); 3319 proc = get_process (process);
3320 send_process (proc, XSTRING (string)->data, 3320 send_process (proc, XSTRING (string)->data,
3321 XSTRING (string)->size_byte, string); 3321 STRING_BYTES (XSTRING (string)), string);
3322 return Qnil; 3322 return Qnil;
3323} 3323}
3324 3324
diff --git a/src/search.c b/src/search.c
index f23c81bb829..dcf486d0dd0 100644
--- a/src/search.c
+++ b/src/search.c
@@ -135,7 +135,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
135 if (multibyte == STRING_MULTIBYTE (pattern)) 135 if (multibyte == STRING_MULTIBYTE (pattern))
136 { 136 {
137 raw_pattern = (char *) XSTRING (pattern)->data; 137 raw_pattern = (char *) XSTRING (pattern)->data;
138 raw_pattern_size = XSTRING (pattern)->size_byte; 138 raw_pattern_size = STRING_BYTES (XSTRING (pattern));
139 } 139 }
140 else if (multibyte) 140 else if (multibyte)
141 { 141 {
@@ -156,7 +156,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
156 raw_pattern_size = XSTRING (pattern)->size; 156 raw_pattern_size = XSTRING (pattern)->size;
157 raw_pattern = (char *) alloca (raw_pattern_size + 1); 157 raw_pattern = (char *) alloca (raw_pattern_size + 1);
158 copy_text (XSTRING (pattern)->data, raw_pattern, 158 copy_text (XSTRING (pattern)->data, raw_pattern,
159 XSTRING (pattern)->size_byte, 1, 0); 159 STRING_BYTES (XSTRING (pattern)), 1, 0);
160 } 160 }
161 161
162 cp->regexp = Qnil; 162 cp->regexp = Qnil;
@@ -368,8 +368,8 @@ string_match_1 (regexp, string, start, posix)
368 re_match_object = string; 368 re_match_object = string;
369 369
370 val = re_search (bufp, (char *) XSTRING (string)->data, 370 val = re_search (bufp, (char *) XSTRING (string)->data,
371 XSTRING (string)->size_byte, pos_byte, 371 STRING_BYTES (XSTRING (string)), pos_byte,
372 XSTRING (string)->size_byte - pos_byte, 372 STRING_BYTES (XSTRING (string)) - pos_byte,
373 &search_regs); 373 &search_regs);
374 immediate_quit = 0; 374 immediate_quit = 0;
375 last_thing_searched = Qt; 375 last_thing_searched = Qt;
@@ -431,8 +431,8 @@ fast_string_match (regexp, string)
431 re_match_object = string; 431 re_match_object = string;
432 432
433 val = re_search (bufp, (char *) XSTRING (string)->data, 433 val = re_search (bufp, (char *) XSTRING (string)->data,
434 XSTRING (string)->size_byte, 0, XSTRING (string)->size_byte, 434 STRING_BYTES (XSTRING (string)), 0,
435 0); 435 STRING_BYTES (XSTRING (string)), 0);
436 immediate_quit = 0; 436 immediate_quit = 0;
437 return val; 437 return val;
438} 438}
@@ -930,7 +930,7 @@ static int
930trivial_regexp_p (regexp) 930trivial_regexp_p (regexp)
931 Lisp_Object regexp; 931 Lisp_Object regexp;
932{ 932{
933 int len = XSTRING (regexp)->size_byte; 933 int len = STRING_BYTES (XSTRING (regexp));
934 unsigned char *s = XSTRING (regexp)->data; 934 unsigned char *s = XSTRING (regexp)->data;
935 unsigned char c; 935 unsigned char c;
936 while (--len >= 0) 936 while (--len >= 0)
@@ -1004,7 +1004,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1004 int posix; 1004 int posix;
1005{ 1005{
1006 int len = XSTRING (string)->size; 1006 int len = XSTRING (string)->size;
1007 int len_byte = XSTRING (string)->size_byte; 1007 int len_byte = STRING_BYTES (XSTRING (string));
1008 register int i; 1008 register int i;
1009 1009
1010 if (running_asynch_code) 1010 if (running_asynch_code)
@@ -1143,7 +1143,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1143 { 1143 {
1144 raw_pattern = (char *) XSTRING (string)->data; 1144 raw_pattern = (char *) XSTRING (string)->data;
1145 raw_pattern_size = XSTRING (string)->size; 1145 raw_pattern_size = XSTRING (string)->size;
1146 raw_pattern_size_byte = XSTRING (string)->size_byte; 1146 raw_pattern_size_byte = STRING_BYTES (XSTRING (string));
1147 } 1147 }
1148 else if (multibyte) 1148 else if (multibyte)
1149 { 1149 {
@@ -1167,7 +1167,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1167 raw_pattern_size_byte = XSTRING (string)->size; 1167 raw_pattern_size_byte = XSTRING (string)->size;
1168 raw_pattern = (char *) alloca (raw_pattern_size + 1); 1168 raw_pattern = (char *) alloca (raw_pattern_size + 1);
1169 copy_text (XSTRING (string)->data, raw_pattern, 1169 copy_text (XSTRING (string)->data, raw_pattern,
1170 XSTRING (string)->size_byte, 1, 0); 1170 STRING_BYTES (XSTRING (string)), 1, 0);
1171 } 1171 }
1172 1172
1173 /* Copy and optionally translate the pattern. */ 1173 /* Copy and optionally translate the pattern. */
@@ -1951,13 +1951,13 @@ wordify (string)
1951 1951
1952 adjust = - punct_count + 5 * (word_count - 1) + 4; 1952 adjust = - punct_count + 5 * (word_count - 1) + 4;
1953 val = make_uninit_multibyte_string (len + adjust, 1953 val = make_uninit_multibyte_string (len + adjust,
1954 XSTRING (string)->size_byte + adjust); 1954 STRING_BYTES (XSTRING (string)) + adjust);
1955 1955
1956 o = XSTRING (val)->data; 1956 o = XSTRING (val)->data;
1957 *o++ = '\\'; 1957 *o++ = '\\';
1958 *o++ = 'b'; 1958 *o++ = 'b';
1959 1959
1960 for (i = 0; i < XSTRING (val)->size_byte; i++) 1960 for (i = 0; i < STRING_BYTES (XSTRING (val)); i++)
1961 if (SYNTAX (p[i]) == Sword) 1961 if (SYNTAX (p[i]) == Sword)
1962 *o++ = p[i]; 1962 *o++ = p[i];
1963 else if (i > 0 && SYNTAX (p[i-1]) == Sword && --word_count) 1963 else if (i > 0 && SYNTAX (p[i-1]) == Sword && --word_count)
@@ -2283,7 +2283,7 @@ since only regular expressions have distinguished subexpressions.")
2283 2283
2284 accum = Qnil; 2284 accum = Qnil;
2285 2285
2286 for (pos_byte = 0, pos = 0; pos_byte < XSTRING (newtext)->size_byte;) 2286 for (pos_byte = 0, pos = 0; pos_byte < STRING_BYTES (XSTRING (newtext));)
2287 { 2287 {
2288 int substart = -1; 2288 int substart = -1;
2289 int subend; 2289 int subend;
@@ -2693,12 +2693,12 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
2693 2693
2694 CHECK_STRING (string, 0); 2694 CHECK_STRING (string, 0);
2695 2695
2696 temp = (unsigned char *) alloca (XSTRING (string)->size_byte * 2); 2696 temp = (unsigned char *) alloca (STRING_BYTES (XSTRING (string)) * 2);
2697 2697
2698 /* Now copy the data into the new string, inserting escapes. */ 2698 /* Now copy the data into the new string, inserting escapes. */
2699 2699
2700 in = XSTRING (string)->data; 2700 in = XSTRING (string)->data;
2701 end = in + XSTRING (string)->size_byte; 2701 end = in + STRING_BYTES (XSTRING (string));
2702 out = temp; 2702 out = temp;
2703 2703
2704 for (; in != end; in++) 2704 for (; in != end; in++)
diff --git a/src/xdisp.c b/src/xdisp.c
index b9128fa0a7b..d05aa173e15 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -877,7 +877,7 @@ x_consider_frame_title (frame)
877 already wasted too much time by walking through the list with 877 already wasted too much time by walking through the list with
878 display_mode_element, then we might need to optimize at a higher 878 display_mode_element, then we might need to optimize at a higher
879 level than this.) */ 879 level than this.) */
880 if (! STRINGP (f->name) || XSTRING (f->name)->size_byte != len 880 if (! STRINGP (f->name) || STRING_BYTES (XSTRING (f->name)) != len
881 || bcmp (frame_title_buf, XSTRING (f->name)->data, len) != 0) 881 || bcmp (frame_title_buf, XSTRING (f->name)->data, len) != 0)
882 x_implicitly_set_name (f, make_string (frame_title_buf, len), Qnil); 882 x_implicitly_set_name (f, make_string (frame_title_buf, len), Qnil);
883} 883}
@@ -3231,7 +3231,7 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done)
3231 3231
3232 minibuf_prompt_width 3232 minibuf_prompt_width
3233 = (display_string (w, vpos, XSTRING (minibuf_prompt)->data, 3233 = (display_string (w, vpos, XSTRING (minibuf_prompt)->data,
3234 XSTRING (minibuf_prompt)->size_byte, 3234 STRING_BYTES (XSTRING (minibuf_prompt)),
3235 hpos + WINDOW_LEFT_MARGIN (w), 3235 hpos + WINDOW_LEFT_MARGIN (w),
3236 /* Display a space if we truncate. */ 3236 /* Display a space if we truncate. */
3237 ' ', 3237 ' ',
@@ -4104,7 +4104,7 @@ display_menu_bar (w)
4104 if (hpos < maxendcol) 4104 if (hpos < maxendcol)
4105 hpos = display_string (w, vpos, 4105 hpos = display_string (w, vpos,
4106 XSTRING (string)->data, 4106 XSTRING (string)->data,
4107 XSTRING (string)->size_byte, 4107 STRING_BYTES (XSTRING (string)),
4108 hpos, 0, 0, hpos, maxendcol, 4108 hpos, 0, 0, hpos, maxendcol,
4109 STRING_MULTIBYTE (string)); 4109 STRING_MULTIBYTE (string));
4110 /* Put a space between items. */ 4110 /* Put a space between items. */
@@ -4311,7 +4311,7 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt)
4311 minendcol, maxendcol); 4311 minendcol, maxendcol);
4312 else 4312 else
4313 hpos = display_string (w, vpos, XSTRING (tem)->data, 4313 hpos = display_string (w, vpos, XSTRING (tem)->data,
4314 XSTRING (tem)->size_byte, 4314 STRING_BYTES (XSTRING (tem)),
4315 hpos, 0, 1, minendcol, maxendcol, 4315 hpos, 0, 1, minendcol, maxendcol,
4316 STRING_MULTIBYTE (tem)); 4316 STRING_MULTIBYTE (tem));
4317 } 4317 }
@@ -4607,7 +4607,7 @@ decode_mode_spec (w, c, spec_width, maxwidth)
4607 case 'b': 4607 case 'b':
4608 obj = b->name; 4608 obj = b->name;
4609#if 0 4609#if 0
4610 if (maxwidth >= 3 && XSTRING (obj)->size_byte > maxwidth) 4610 if (maxwidth >= 3 && STRING_BYTES (XSTRING (obj)) > maxwidth)
4611 { 4611 {
4612 bcopy (XSTRING (obj)->data, decode_mode_spec_buf, maxwidth - 1); 4612 bcopy (XSTRING (obj)->data, decode_mode_spec_buf, maxwidth - 1);
4613 decode_mode_spec_buf[maxwidth - 1] = '\\'; 4613 decode_mode_spec_buf[maxwidth - 1] = '\\';
@@ -4641,10 +4641,10 @@ decode_mode_spec (w, c, spec_width, maxwidth)
4641#if 0 4641#if 0
4642 if (NILP (obj)) 4642 if (NILP (obj))
4643 return "[none]"; 4643 return "[none]";
4644 else if (STRINGP (obj) && XSTRING (obj)->size_byte > maxwidth) 4644 else if (STRINGP (obj) && STRING_BYTES (XSTRING (obj)) > maxwidth)
4645 { 4645 {
4646 bcopy ("...", decode_mode_spec_buf, 3); 4646 bcopy ("...", decode_mode_spec_buf, 3);
4647 bcopy (XSTRING (obj)->data + XSTRING (obj)->size_byte - maxwidth + 3, 4647 bcopy (XSTRING (obj)->data + STRING_BYTES (XSTRING (obj)) - maxwidth + 3,
4648 decode_mode_spec_buf + 3, maxwidth - 3); 4648 decode_mode_spec_buf + 3, maxwidth - 3);
4649 return decode_mode_spec_buf; 4649 return decode_mode_spec_buf;
4650 } 4650 }
diff --git a/src/xfns.c b/src/xfns.c
index bc704cc15f3..6b209b704a6 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -600,7 +600,7 @@ x_create_bitmap_from_file (f, file)
600 dpyinfo->bitmaps[id - 1].pixmap = bitmap; 600 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
601 dpyinfo->bitmaps[id - 1].refcount = 1; 601 dpyinfo->bitmaps[id - 1].refcount = 1;
602 dpyinfo->bitmaps[id - 1].file 602 dpyinfo->bitmaps[id - 1].file
603 = (char *) xmalloc (XSTRING (file)->size_byte + 1); 603 = (char *) xmalloc (STRING_BYTES (XSTRING (file)) + 1);
604 dpyinfo->bitmaps[id - 1].depth = 1; 604 dpyinfo->bitmaps[id - 1].depth = 1;
605 dpyinfo->bitmaps[id - 1].height = height; 605 dpyinfo->bitmaps[id - 1].height = height;
606 dpyinfo->bitmaps[id - 1].width = width; 606 dpyinfo->bitmaps[id - 1].width = width;
@@ -1823,14 +1823,14 @@ x_set_name (f, name, explicit)
1823 text.value = XSTRING (name)->data; 1823 text.value = XSTRING (name)->data;
1824 text.encoding = XA_STRING; 1824 text.encoding = XA_STRING;
1825 text.format = 8; 1825 text.format = 8;
1826 text.nitems = XSTRING (name)->size_byte; 1826 text.nitems = STRING_BYTES (XSTRING (name));
1827 1827
1828 icon_name = (!NILP (f->icon_name) ? f->icon_name : name); 1828 icon_name = (!NILP (f->icon_name) ? f->icon_name : name);
1829 1829
1830 icon.value = XSTRING (icon_name)->data; 1830 icon.value = XSTRING (icon_name)->data;
1831 icon.encoding = XA_STRING; 1831 icon.encoding = XA_STRING;
1832 icon.format = 8; 1832 icon.format = 8;
1833 icon.nitems = XSTRING (icon_name)->size_byte; 1833 icon.nitems = STRING_BYTES (XSTRING (icon_name));
1834#ifdef USE_X_TOOLKIT 1834#ifdef USE_X_TOOLKIT
1835 XSetWMName (FRAME_X_DISPLAY (f), 1835 XSetWMName (FRAME_X_DISPLAY (f),
1836 XtWindow (f->output_data.x->widget), &text); 1836 XtWindow (f->output_data.x->widget), &text);
@@ -1913,14 +1913,14 @@ x_set_title (f, name)
1913 text.value = XSTRING (name)->data; 1913 text.value = XSTRING (name)->data;
1914 text.encoding = XA_STRING; 1914 text.encoding = XA_STRING;
1915 text.format = 8; 1915 text.format = 8;
1916 text.nitems = XSTRING (name)->size_byte; 1916 text.nitems = STRING_BYTES (XSTRING (name));
1917 1917
1918 icon_name = (!NILP (f->icon_name) ? f->icon_name : name); 1918 icon_name = (!NILP (f->icon_name) ? f->icon_name : name);
1919 1919
1920 icon.value = XSTRING (icon_name)->data; 1920 icon.value = XSTRING (icon_name)->data;
1921 icon.encoding = XA_STRING; 1921 icon.encoding = XA_STRING;
1922 icon.format = 8; 1922 icon.format = 8;
1923 icon.nitems = XSTRING (icon_name)->size_byte; 1923 icon.nitems = STRING_BYTES (XSTRING (icon_name));
1924#ifdef USE_X_TOOLKIT 1924#ifdef USE_X_TOOLKIT
1925 XSetWMName (FRAME_X_DISPLAY (f), 1925 XSetWMName (FRAME_X_DISPLAY (f),
1926 XtWindow (f->output_data.x->widget), &text); 1926 XtWindow (f->output_data.x->widget), &text);
@@ -2050,7 +2050,7 @@ validate_x_resource_name ()
2050 unsigned char *p = XSTRING (Vx_resource_name)->data; 2050 unsigned char *p = XSTRING (Vx_resource_name)->data;
2051 int i; 2051 int i;
2052 2052
2053 len = XSTRING (Vx_resource_name)->size_byte; 2053 len = STRING_BYTES (XSTRING (Vx_resource_name));
2054 2054
2055 /* Only letters, digits, - and _ are valid in resource names. 2055 /* Only letters, digits, - and _ are valid in resource names.
2056 Count the valid characters and count the invalid ones. */ 2056 Count the valid characters and count the invalid ones. */
@@ -2134,16 +2134,16 @@ and the class is `Emacs.CLASS.SUBCLASS'.")
2134 2134
2135 /* Allocate space for the components, the dots which separate them, 2135 /* Allocate space for the components, the dots which separate them,
2136 and the final '\0'. Make them big enough for the worst case. */ 2136 and the final '\0'. Make them big enough for the worst case. */
2137 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size_byte 2137 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name))
2138 + (STRINGP (component) 2138 + (STRINGP (component)
2139 ? XSTRING (component)->size_byte : 0) 2139 ? STRING_BYTES (XSTRING (component)) : 0)
2140 + XSTRING (attribute)->size_byte 2140 + STRING_BYTES (XSTRING (attribute))
2141 + 3); 2141 + 3);
2142 2142
2143 class_key = (char *) alloca (XSTRING (Vx_resource_class)->size_byte 2143 class_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_class))
2144 + XSTRING (class)->size_byte 2144 + STRING_BYTES (XSTRING (class))
2145 + (STRINGP (subclass) 2145 + (STRINGP (subclass)
2146 ? XSTRING (subclass)->size_byte : 0) 2146 ? STRING_BYTES (XSTRING (subclass)) : 0)
2147 + 3); 2147 + 3);
2148 2148
2149 /* Start with emacs.FRAMENAME for the name (the specific one) 2149 /* Start with emacs.FRAMENAME for the name (the specific one)
@@ -2202,16 +2202,16 @@ display_x_get_resource (dpyinfo, attribute, class, component, subclass)
2202 2202
2203 /* Allocate space for the components, the dots which separate them, 2203 /* Allocate space for the components, the dots which separate them,
2204 and the final '\0'. Make them big enough for the worst case. */ 2204 and the final '\0'. Make them big enough for the worst case. */
2205 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size_byte 2205 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name))
2206 + (STRINGP (component) 2206 + (STRINGP (component)
2207 ? XSTRING (component)->size_byte : 0) 2207 ? STRING_BYTES (XSTRING (component)) : 0)
2208 + XSTRING (attribute)->size_byte 2208 + STRING_BYTES (XSTRING (attribute))
2209 + 3); 2209 + 3);
2210 2210
2211 class_key = (char *) alloca (XSTRING (Vx_resource_class)->size_byte 2211 class_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_class))
2212 + XSTRING (class)->size_byte 2212 + STRING_BYTES (XSTRING (class))
2213 + (STRINGP (subclass) 2213 + (STRINGP (subclass)
2214 ? XSTRING (subclass)->size_byte : 0) 2214 ? STRING_BYTES (XSTRING (subclass)) : 0)
2215 + 3); 2215 + 3);
2216 2216
2217 /* Start with emacs.FRAMENAME for the name (the specific one) 2217 /* Start with emacs.FRAMENAME for the name (the specific one)
@@ -2254,7 +2254,7 @@ x_get_resource_string (attribute, class)
2254 2254
2255 /* Allocate space for the components, the dots which separate them, 2255 /* Allocate space for the components, the dots which separate them,
2256 and the final '\0'. */ 2256 and the final '\0'. */
2257 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size_byte 2257 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name))
2258 + strlen (attribute) + 2); 2258 + strlen (attribute) + 2);
2259 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) 2259 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
2260 + strlen (class) + 2); 2260 + strlen (class) + 2);
@@ -4871,7 +4871,8 @@ also be depressed for NEWSTRING to appear.")
4871 4871
4872 if (NILP (modifiers)) 4872 if (NILP (modifiers))
4873 XRebindKeysym (x_current_display, keysym, modifier_list, 0, 4873 XRebindKeysym (x_current_display, keysym, modifier_list, 0,
4874 XSTRING (newstring)->data, XSTRING (newstring)->size_byte); 4874 XSTRING (newstring)->data,
4875 STRING_BYTES (XSTRING (newstring)));
4875 else 4876 else
4876 { 4877 {
4877 register Lisp_Object rest, mod; 4878 register Lisp_Object rest, mod;
@@ -4899,7 +4900,8 @@ also be depressed for NEWSTRING to appear.")
4899 } 4900 }
4900 4901
4901 XRebindKeysym (x_current_display, keysym, modifier_list, i, 4902 XRebindKeysym (x_current_display, keysym, modifier_list, i,
4902 XSTRING (newstring)->data, XSTRING (newstring)->size_byte); 4903 XSTRING (newstring)->data,
4904 STRING_BYTES (XSTRING (newstring)));
4903 } 4905 }
4904 4906
4905 return Qnil; 4907 return Qnil;
@@ -4930,7 +4932,7 @@ See the documentation of `x-rebind-key' for more information.")
4930 if (!NILP (item)) 4932 if (!NILP (item))
4931 { 4933 {
4932 CHECK_STRING (item, 2); 4934 CHECK_STRING (item, 2);
4933 strsize = XSTRING (item)->size_byte; 4935 strsize = STRING_BYTES (XSTRING (item));
4934 rawstring = (unsigned char *) xmalloc (strsize); 4936 rawstring = (unsigned char *) xmalloc (strsize);
4935 bcopy (XSTRING (item)->data, rawstring, strsize); 4937 bcopy (XSTRING (item)->data, rawstring, strsize);
4936 modifier[1] = 1 << i; 4938 modifier[1] = 1 << i;
diff --git a/src/xmenu.c b/src/xmenu.c
index ef51f83ee3c..1e6b0b13f1f 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -2436,7 +2436,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
2436 j++; 2436 j++;
2437 continue; 2437 continue;
2438 } 2438 }
2439 width = XSTRING (item)->size_byte; 2439 width = STRING_BYTES (XSTRING (item));
2440 if (width > maxwidth) 2440 if (width > maxwidth)
2441 maxwidth = width; 2441 maxwidth = width;
2442 2442
@@ -2459,7 +2459,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
2459 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; 2459 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
2460 if (!NILP (descrip)) 2460 if (!NILP (descrip))
2461 { 2461 {
2462 int gap = maxwidth - XSTRING (item_name)->size_byte; 2462 int gap = maxwidth - STRING_BYTES (XSTRING (item_name));
2463#ifdef C_ALLOCA 2463#ifdef C_ALLOCA
2464 Lisp_Object spacer; 2464 Lisp_Object spacer;
2465 spacer = Fmake_string (make_number (gap), make_number (' ')); 2465 spacer = Fmake_string (make_number (gap), make_number (' '));
@@ -2471,14 +2471,14 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
2471 to reduce gc needs. */ 2471 to reduce gc needs. */
2472 item_data 2472 item_data
2473 = (unsigned char *) alloca (maxwidth 2473 = (unsigned char *) alloca (maxwidth
2474 + XSTRING (descrip)->size_byte + 1); 2474 + STRING_BYTES (XSTRING (descrip)) + 1);
2475 bcopy (XSTRING (item_name)->data, item_data, 2475 bcopy (XSTRING (item_name)->data, item_data,
2476 XSTRING (item_name)->size_byte); 2476 STRING_BYTES (XSTRING (item_name)));
2477 for (j = XSTRING (item_name)->size; j < maxwidth; j++) 2477 for (j = XSTRING (item_name)->size; j < maxwidth; j++)
2478 item_data[j] = ' '; 2478 item_data[j] = ' ';
2479 bcopy (XSTRING (descrip)->data, item_data + j, 2479 bcopy (XSTRING (descrip)->data, item_data + j,
2480 XSTRING (descrip)->size_byte); 2480 STRING_BYTES (XSTRING (descrip)));
2481 item_data[j + XSTRING (descrip)->size_byte] = 0; 2481 item_data[j + STRING_BYTES (XSTRING (descrip))] = 0;
2482#endif 2482#endif
2483 } 2483 }
2484 else 2484 else
diff --git a/src/xselect.c b/src/xselect.c
index ec8d2af5388..475a2fdd1d7 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1611,7 +1611,7 @@ lisp_data_to_selection_data (display, obj,
1611 int num; 1611 int num;
1612 1612
1613 *format_ret = 8; 1613 *format_ret = 8;
1614 *size_ret = XSTRING (obj)->size_byte; 1614 *size_ret = STRING_BYTES (XSTRING (obj));
1615 *data_ret = XSTRING (obj)->data; 1615 *data_ret = XSTRING (obj)->data;
1616 bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); 1616 bzero (charsets, (MAX_CHARSET + 1) * sizeof (int));
1617 num = ((*size_ret <= 1 /* Check the possibility of short cut. */ 1617 num = ((*size_ret <= 1 /* Check the possibility of short cut. */
@@ -2134,7 +2134,7 @@ DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal,
2134 buffer_atom = symbol_to_x_atom (FRAME_X_DISPLAY_INFO (selected_frame), 2134 buffer_atom = symbol_to_x_atom (FRAME_X_DISPLAY_INFO (selected_frame),
2135 display, buffer); 2135 display, buffer);
2136 data = (unsigned char *) XSTRING (string)->data; 2136 data = (unsigned char *) XSTRING (string)->data;
2137 bytes = XSTRING (string)->size_byte; 2137 bytes = STRING_BYTES (XSTRING (string));
2138 bytes_remaining = bytes; 2138 bytes_remaining = bytes;
2139 2139
2140 if (! FRAME_X_DISPLAY_INFO (selected_frame)->cut_buffers_initialized) 2140 if (! FRAME_X_DISPLAY_INFO (selected_frame)->cut_buffers_initialized)
diff --git a/src/xterm.c b/src/xterm.c
index 9d8e40b7de6..52cb889d4c7 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6933,8 +6933,8 @@ x_term_init (display_name, xrm_option, resource_name)
6933#endif /* ! 0 */ 6933#endif /* ! 0 */
6934 6934
6935 dpyinfo->x_id_name 6935 dpyinfo->x_id_name
6936 = (char *) xmalloc (XSTRING (Vinvocation_name)->size_byte 6936 = (char *) xmalloc (STRING_BYTES (XSTRING (Vinvocation_name))
6937 + XSTRING (Vsystem_name)->size_byte 6937 + STRING_BYTES (XSTRING (Vsystem_name))
6938 + 2); 6938 + 2);
6939 sprintf (dpyinfo->x_id_name, "%s@%s", 6939 sprintf (dpyinfo->x_id_name, "%s@%s",
6940 XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data); 6940 XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data);