+2012-07-09 Paul Eggert <eggert@cs.ucla.edu>
+
+ Minor improvements to make_formatted_string.
+ * alloc.c (make_formatted_string): Prefer int to ptrdiff_t
+ where int is good enough, as vsprintf returns an int.
+ * lisp.h (make_formatted_string): Add ATTRIBUTE_FORMAT_PRINTF.
+
2012-07-09 Dmitry Antipov <dmantipov@yandex.ru>
Use make_formatted_string to avoid double length calculation.
make_formatted_string (char *buf, const char *format, ...)
{
va_list ap;
- ptrdiff_t length;
+ int length;
va_start (ap, format);
length = vsprintf (buf, format, ap);
extern Lisp_Object allocate_misc (void);
extern _Noreturn void string_overflow (void);
extern Lisp_Object make_string (const char *, ptrdiff_t);
-extern Lisp_Object make_formatted_string (char *, const char *, ...);
+extern Lisp_Object make_formatted_string (char *, const char *, ...)
+ ATTRIBUTE_FORMAT_PRINTF (2, 3);
extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t);
extern Lisp_Object make_multibyte_string (const char *, ptrdiff_t, ptrdiff_t);
extern Lisp_Object make_event_array (int, Lisp_Object *);