util: define a cleanup for stringbuf

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
This commit is contained in:
Peter Hutterer 2025-04-07 10:52:21 +10:00
parent 829aec8055
commit ae423bc3fe

View file

@ -28,6 +28,7 @@
#include <unistd.h>
#include "util-macros.h"
#include "util-mem.h"
struct stringbuf {
char *data;
@ -74,6 +75,8 @@ stringbuf_destroy(struct stringbuf *b)
free(b);
}
DEFINE_DESTROY_CLEANUP_FUNC(stringbuf);
static inline char *
stringbuf_steal_destroy(struct stringbuf *b)
{