comparison src/print.c @ 21244:50929073a0ba

Use STRING_BYTES and SET_STRING_BYTES.
author Richard M. Stallman <rms@gnu.org>
date Sat, 21 Mar 1998 07:06:14 +0000
parents 77b24424ae6b
children c6212caa6fe2
comparison
equal deleted inserted replaced
21243:e82a4a4fa12a 21244:50929073a0ba
534 { 534 {
535 if (EQ (printcharfun, Qt) || NILP (printcharfun)) 535 if (EQ (printcharfun, Qt) || NILP (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 {
543 /* Otherwise, string may be relocated by printing one char. 543 /* Otherwise, string may be relocated by printing one char.
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)
551 for (i = 0; i < size; i++) 551 for (i = 0; i < size; i++)
552 PRINTCHAR (XSTRING (string)->data[i]); 552 PRINTCHAR (XSTRING (string)->data[i]);
1160 PRINTCHAR ('('); 1160 PRINTCHAR ('(');
1161 } 1161 }
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 {
1169 /* Here, we must convert each multi-byte form to the 1169 /* Here, we must convert each multi-byte form to the
1170 corresponding character code before handing it to PRINTCHAR. */ 1170 corresponding character code before handing it to PRINTCHAR. */
1232 1232
1233 case Lisp_Symbol: 1233 case Lisp_Symbol:
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;
1241 1241
1242 XSETSTRING (name, XSYMBOL (obj)->name); 1242 XSETSTRING (name, XSYMBOL (obj)->name);
1294 } 1294 }
1295 PRINTCHAR ('#'); 1295 PRINTCHAR ('#');
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 {
1303 /* Here, we must convert each multi-byte form to the 1303 /* Here, we must convert each multi-byte form to the
1304 corresponding character code before handing it to PRINTCHAR. */ 1304 corresponding character code before handing it to PRINTCHAR. */