summaryrefslogtreecommitdiff
path: root/globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'globals.c')
-rw-r--r--globals.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/globals.c b/globals.c
index 66c5bfb..bbecb59 100644
--- a/globals.c
+++ b/globals.c
@@ -1,8 +1,6 @@
-#include <stdio.h>
-#include <stdint.h>
#include <wayland-client.h>
+#include "util.h"
-void plog(char *type, char *fmt, ...);
static void
registry_handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version);
@@ -20,7 +18,7 @@ static void
registry_handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version)
{
- plog("info", "interface: %s, version: %d, name: %d", interface,
+ plog(PLOG_INFO, "interface: %s, version: %d, name: %d", interface,
version, name);
}
@@ -28,19 +26,7 @@ static void
registry_handle_global_remove(void *data, struct wl_registry *registry,
uint32_t name)
{
- plog("info", "interface with name %d removed", name);
-}
-
-void plog(char *type, char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- fprintf(stderr, "%s",type);
- fprintf(stderr, ": ");
- vfprintf(stderr, fmt, args);
- putc('\n', stderr);
- va_end(args);
+ plog(PLOG_INFO, "interface with name %d removed", name);
}
int main(void)
@@ -50,10 +36,10 @@ int main(void)
display = wl_display_connect(NULL);
if (!display) {
- plog("eror", "Unable to connect to wayland display");
+ plog(PLOG_ERR, "Unable to connect to wayland display");
return 1;
}
- plog("info", "Running wayland display");
+ plog(PLOG_INFO, "Running wayland display");
registry = wl_display_get_registry(display);
wl_registry_add_listener(registry, &registry_listener, NULL);