[pulseaudio-commits] r1544 - /branches/lennart/src/pulsecore/log.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Jul 26 06:55:54 PDT 2007


Author: lennart
Date: Thu Jul 26 15:55:52 2007
New Revision: 1544

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1544&root=3Dpulseaudio&vi=
ew=3Drev
Log:
make valgrind shut up regarding non-freed ident strings. other modernizatio=
ns

Modified:
    branches/lennart/src/pulsecore/log.c

Modified: branches/lennart/src/pulsecore/log.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
log.c?rev=3D1544&root=3Dpulseaudio&r1=3D1543&r2=3D1544&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/log.c (original)
+++ branches/lennart/src/pulsecore/log.c Thu Jul 26 15:55:52 2007
@@ -26,7 +26,6 @@
 #include <config.h>
 #endif
 =

-#include <assert.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -40,6 +39,7 @@
 #include <pulse/xmalloc.h>
 #include <pulse/util.h>
 =

+#include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
 =

 #include "log.h"
@@ -79,13 +79,22 @@
         log_ident_local =3D pa_xstrdup(log_ident);
 }
 =

+/* To make valgrind shut up. */
+static void ident_destructor(void) PA_GCC_DESTRUCTOR; =

+static void ident_destructor(void) {
+    pa_xfree(log_ident);
+    pa_xfree(log_ident_local);
+}
+
 void pa_log_set_maximal_level(pa_log_level_t l) {
-    assert(l < PA_LOG_LEVEL_MAX);
+    pa_assert(l < PA_LOG_LEVEL_MAX);
+    =

     maximal_level =3D l;
 }
 =

 void pa_log_set_target(pa_log_target_t t, void (*func)(pa_log_level_t l, c=
onst char*s)) {
-    assert(t =3D=3D PA_LOG_USER || !func);
+    pa_assert(t =3D=3D PA_LOG_USER || !func);
+    =

     log_target =3D t;
     user_log_func =3D func;
 }
@@ -101,8 +110,8 @@
     const char *e;
     char *text, *t, *n, *location;
 =

-    assert(level < PA_LOG_LEVEL_MAX);
-    assert(format);
+    pa_assert(level < PA_LOG_LEVEL_MAX);
+    pa_assert(format);
 =

     if ((e =3D getenv(ENV_LOGLEVEL)))
         maximal_level =3D atoi(e);
@@ -218,6 +227,7 @@
 =

 void pa_log_level(pa_log_level_t level, const char *format, ...) {
     va_list ap;
+    =

     va_start(ap, format);
     pa_log_levelv_meta(level, NULL, 0, NULL, format, ap);
     va_end(ap);




More information about the pulseaudio-commits mailing list