Commit 26bccfae authored by Paul Eggert's avatar Paul Eggert

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.
parent 52331d2c
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.
......
......@@ -2524,7 +2524,7 @@ Lisp_Object
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);
......
......@@ -2611,7 +2611,8 @@ extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
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 *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment