summaryrefslogtreecommitdiff
path: root/src/bar.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-12-21 11:58:56 +0000
committersabetts <sabetts>2001-12-21 11:58:56 +0000
commitb411861a7c307f2f2e520f7c9d51958fc003f0df (patch)
treee73d98b5877d39754260ed163242935ffba76951 /src/bar.c
parent8337770d09d8041ba4c6b676d1fbb5bc7fd6c6a2 (diff)
downloadratpoison-b411861a7c307f2f2e520f7c9d51958fc003f0df.zip
* src/sbuf.h (sbuf_printf_concat): new prototype
(sbuf_printf): likewise * src/sbuf.c (sbuf_printf_concat): new function (sbuf_printf): likewise * src/ratpoison.h: include stdarg.h (xvsprintf): new prototype (xsprintf): likewise * src/main.c (xvsprintf): new function (xsprintf): likewise * src/bar.c: remove include of stdarg.h (marked_message_printf): call xvsprintf.
Diffstat (limited to 'src/bar.c')
-rw-r--r--src/bar.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/bar.c b/src/bar.c
index 8e34d25..f2a6940 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <stdarg.h>
#include "ratpoison.h"
@@ -121,36 +120,11 @@ update_window_names (screen_info *s)
void
marked_message_printf (int mark_start, int mark_end, char *fmt, ...)
{
- int size, nchars;
char *buffer;
va_list ap;
va_start (ap, fmt);
-
- /* A resonable starting value. */
- size = strlen (fmt) + 1;
- buffer = (char *)xmalloc (size);
-
- nchars = vsnprintf (buffer, size, fmt, ap);
-
- /* From the GNU Libc manual: In versions of the GNU C library prior
- to 2.1 the return value is the number of characters stored, not
- including the terminating null; unless there was not enough space
- in S to store the result in which case `-1' is returned. */
- if (nchars == -1)
- {
- do
- {
- size *= 2;
- buffer = (char *)xrealloc (buffer, size);
- } while (vsnprintf (buffer, size, fmt, ap) == -1);
- }
- else if (nchars >= size)
- {
- buffer = (char *)xrealloc (buffer, nchars + 1);
- vsnprintf (buffer, nchars + 1, fmt, ap);
- }
-
+ buffer = xvsprintf (fmt, ap);
va_end (ap);
marked_message (buffer, mark_start, mark_end);