- bcopy (start, bufp, length);
- bufp += length;
- /* Check STR again in case gc relocated it. */
- strp = (unsigned char *) XSTRING (str)->data + idx;
+ bcopy (start, bufp, length_byte);
+ bufp += length_byte;
+ nchars += length;
+ /* Check STRING again in case gc relocated it. */
+ strp = (unsigned char *) XSTRING (string)->data + idx;
+ }
+ else if (! multibyte) /* just copy other chars */
+ *bufp++ = *strp++, nchars++;
+ else
+ {
+ int len;
+ int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp;
+
+ STRING_CHAR_AND_LENGTH (strp, maxlen, len);
+ if (len == 1)
+ *bufp = *strp;
+ else
+ bcopy (strp, bufp, len);
+ strp += len;
+ bufp += len;
+ nchars++;