From c5dbf754b578d70d5bf01494fedad74c1829ac38 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 17 Jun 2009 03:13:01 +0200 Subject: core-util: implement pa_xstrfreev() --- src/pulsecore/core-util.c | 12 ++++++++++++ src/pulsecore/core-util.h | 6 ++++++ 2 files changed, 18 insertions(+) (limited to 'src/pulsecore') diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index b747cd84..0b64edba 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -2732,3 +2732,15 @@ void pa_disable_sigpipe(void) { } #endif } + +void pa_xfreev(void**a) { + void **p; + + if (!a) + return; + + for (p = a; *p; p++) + pa_xfree(*p); + + pa_xfree(a); +} diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h index d073b750..5a12ad3f 100644 --- a/src/pulsecore/core-util.h +++ b/src/pulsecore/core-util.h @@ -229,4 +229,10 @@ char *pa_realpath(const char *path); void pa_disable_sigpipe(void); +void pa_xfreev(void**a); + +static inline void pa_xstrfreev(char **a) { + pa_xfreev((void**) a); +} + #endif -- cgit