#define CONVERTED_BYTE_SIZE(MULTIBYTE, STRING) \
(((MULTIBYTE) && ! STRING_MULTIBYTE (STRING)) \
- ? XSTRING (STRING)->size_byte \
- : count_size_as_multibyte (XSTRING (STRING)->data, \
- XSTRING (STRING)->size_byte))
+ ? count_size_as_multibyte (XSTRING (STRING)->data, \
+ XSTRING (STRING)->size_byte) \
+ : XSTRING (STRING)->size_byte)
DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
"Format a string out of a control-string and arguments.\n\
int multibyte = 0;
unsigned char *this_format;
int longest_format = 0;
+ Lisp_Object val;
extern char *index ();
/* For `S', prin1 the argument and then treat like a string. */
register Lisp_Object tem;
tem = Fprin1_to_string (args[n], Qnil);
+ if (STRING_MULTIBYTE (tem))
+ multibyte = 1;
args[n] = tem;
goto string;
}
/* Anything but a string, convert to a string using princ. */
register Lisp_Object tem;
tem = Fprin1_to_string (args[n], Qt);
+ if (STRING_MULTIBYTE (tem))
+ multibyte = 1;
args[n] = tem;
goto string;
}
*p++ = *format++, nchars++;
}
+ val = make_multibyte_string (buf, nchars, p - buf);
+
/* If we allocated BUF with malloc, free it too. */
if (total >= 1000)
xfree (buf);
- return make_multibyte_string (buf, nchars, p - buf);
+ return val;
}
/* VARARGS 1 */