introduce sasprintf() in libi3, use it everywhere

This commit is contained in:
Michael Stapelberg
2011-10-23 13:16:56 +01:00
parent 14abafb3c8
commit 9d15a00ba8
18 changed files with 68 additions and 66 deletions

View File

@ -5,6 +5,7 @@
#ifndef _LIBI3_H
#define _LIBI3_H
#include <stdarg.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
@ -45,6 +46,13 @@ void *srealloc(void *ptr, size_t size);
*/
char *sstrdup(const char *str);
/**
* Safe-wrapper around asprintf which exits if it returns -1 (meaning that
* there is no more memory available)
*
*/
int sasprintf(char **strp, const char *fmt, ...);
/**
* Formats a message (payload) of the given size and type and sends it to i3 via
* the given socket file descriptor.