[pulseaudio-commits] r1728 - in /branches/lennart/src/pulsecore: memchunk.c memchunk.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Thu Aug 30 15:41:34 PDT 2007


Author: lennart
Date: Fri Aug 31 00:41:33 2007
New Revision: 1728

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1728&root=3Dpulseaudio&vi=
ew=3Drev
Log:
fix pa_memchunk_make_writable(), make memchunk functions return the memchun=
k they modify

Modified:
    branches/lennart/src/pulsecore/memchunk.c
    branches/lennart/src/pulsecore/memchunk.h

Modified: branches/lennart/src/pulsecore/memchunk.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
memchunk.c?rev=3D1728&root=3Dpulseaudio&r1=3D1727&r2=3D1728&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/memchunk.c (original)
+++ branches/lennart/src/pulsecore/memchunk.c Fri Aug 31 00:41:33 2007
@@ -34,7 +34,7 @@
 =

 #include "memchunk.h"
 =

-void pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
+pa_memchunk* pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
     pa_memblock *n;
     size_t l;
     void *tdata, *sdata;
@@ -42,9 +42,10 @@
     assert(c);
     assert(c->memblock);
 =

-    if (pa_memblock_is_read_only(c->memblock) &&
+    if (pa_memblock_ref_is_one(c->memblock) &&
+        !pa_memblock_is_read_only(c->memblock) &&
         pa_memblock_get_length(c->memblock) >=3D c->index+min)
-        return;
+        return c;
 =

     l =3D c->length;
     if (l < min)
@@ -59,11 +60,15 @@
     pa_memblock_unref(c->memblock);
     c->memblock =3D n;
     c->index =3D 0;
+
+    return c;
 }
 =

-void pa_memchunk_reset(pa_memchunk *c) {
+pa_memchunk* pa_memchunk_reset(pa_memchunk *c) {
     assert(c);
 =

     c->memblock =3D NULL;
     c->length =3D c->index =3D 0;
+
+    return c;
 }

Modified: branches/lennart/src/pulsecore/memchunk.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
memchunk.h?rev=3D1728&root=3Dpulseaudio&r1=3D1727&r2=3D1728&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/memchunk.h (original)
+++ branches/lennart/src/pulsecore/memchunk.h Fri Aug 31 00:41:33 2007
@@ -38,10 +38,10 @@
 /* Make a memchunk writable, i.e. make sure that the caller may have
  * exclusive access to the memblock and it is not read_only. If needed
  * the memblock in the structure is replaced by a copy. */
-void pa_memchunk_make_writable(pa_memchunk *c, size_t min);
+pa_memchunk* pa_memchunk_make_writable(pa_memchunk *c, size_t min);
 =

 /* Invalidate a memchunk. This does not free the cotaining memblock,
  * but sets all members to zero. */
-void pa_memchunk_reset(pa_memchunk *c);
+pa_memchunk* pa_memchunk_reset(pa_memchunk *c);
 =

 #endif




More information about the pulseaudio-commits mailing list