summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/fmt-pango.c7
-rw-r--r--gui/gui.c5
-rw-r--r--gui/timer.c6
3 files changed, 7 insertions, 11 deletions
diff --git a/gui/fmt-pango.c b/gui/fmt-pango.c
index 8e975dc..48b8516 100644
--- a/gui/fmt-pango.c
+++ b/gui/fmt-pango.c
@@ -11,7 +11,6 @@
*/
-#define _GNU_SOURCE /* for asprintf */
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
@@ -48,7 +47,7 @@ unsigned vsfmt_pango(char *buf, const char *fmt, va_list ap)
switch (*q) {
case 's':
s = va_arg(ap, const char *);
- len = asprintf(&tmp, tmp_fmt, s);
+ len = alloc_printf(&tmp, tmp_fmt, s);
extra = 0;
for (t = tmp; *t; t++)
@@ -97,13 +96,13 @@ unsigned vsfmt_pango(char *buf, const char *fmt, va_list ap)
/* @@@ we don't filter markup meta-characters */
case 'd':
case 'x':
- len = asprintf(&tmp, tmp_fmt, va_arg(ap, int));
+ len = alloc_printf(&tmp, tmp_fmt, va_arg(ap, int));
if (buf)
memcpy(res, tmp, len);
res += len;
break;
case 'u':
- len = asprintf(&tmp, tmp_fmt, va_arg(ap, unsigned));
+ len = alloc_printf(&tmp, tmp_fmt, va_arg(ap, unsigned));
if (buf)
memcpy(res, tmp, len);
res += len;
diff --git a/gui/gui.c b/gui/gui.c
index c566d1d..5c96c6c 100644
--- a/gui/gui.c
+++ b/gui/gui.c
@@ -17,7 +17,6 @@
* https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html
*/
-#define _GNU_SOURCE /* for asprintf */
#include <stddef.h>
#include <stdbool.h>
#include <stdlib.h>
@@ -478,7 +477,7 @@ int run_gui(const struct file_names *fn, bool recurse, int limit,
gtk_container_add(GTK_CONTAINER(window), gui.da);
gtk_window_set_default_size(GTK_WINDOW(window), 640, 480);
- if (asprintf(&title, "eeshow (rev %s)", version)) {};
+ alloc_printf(&title, "eeshow (rev %s)", version);
gtk_window_set_title(GTK_WINDOW(window), title);
gtk_widget_set_events(gui.da,
@@ -517,7 +516,7 @@ int run_gui(const struct file_names *fn, bool recurse, int limit,
gdk_x11_window_get_xid(gtk_widget_get_window(window));
char *s;
- if (asprintf(&s, "0x%lx", xid)) {}
+ alloc_printf(&s, "0x%lx", xid);
setenv("EESHOW_WINDOW_ID", s, 1);
while (n_commands--) {
diff --git a/gui/timer.c b/gui/timer.c
index 6d6cdd6..37304d6 100644
--- a/gui/timer.c
+++ b/gui/timer.c
@@ -10,7 +10,6 @@
* (at your option) any later version.
*/
-#define _GNU_SOURCE /* for asprintf */
#include <stdbool.h>
#include <stdio.h>
#include <sys/time.h>
@@ -64,9 +63,8 @@ void timer_show(cairo_t *cr)
now.tv_usec += 1000000;
}
-
- if (asprintf(&s , "%u.%03d",
- (unsigned) now.tv_sec, (int) now.tv_usec / 1000)) {}
+ alloc_printf(&s , "%u.%03d",
+ (unsigned) now.tv_sec, (int) now.tv_usec / 1000);
timer_show_cairo(cr, s);
}