[pulseaudio-commits] r1519 - /branches/lennart/src/pulsecore/hashmap.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Fri Jul 13 16:22:39 PDT 2007
Author: lennart
Date: Sat Jul 14 01:22:38 2007
New Revision: 1519
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1519&root=3Dpulseaudio&vi=
ew=3Drev
Log:
Make use of static flist for hashmap entry alllocation
Modified:
branches/lennart/src/pulsecore/hashmap.c
Modified: branches/lennart/src/pulsecore/hashmap.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
hashmap.c?rev=3D1519&root=3Dpulseaudio&r1=3D1518&r2=3D1519&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/hashmap.c (original)
+++ branches/lennart/src/pulsecore/hashmap.c Sat Jul 14 01:22:38 2007
@@ -33,6 +33,7 @@
=
#include <pulsecore/idxset.h>
#include <pulsecore/log.h>
+#include <pulsecore/flist.h>
=
#include "hashmap.h"
=
@@ -54,6 +55,8 @@
pa_hash_func_t hash_func;
pa_compare_func_t compare_func;
};
+
+PA_STATIC_FLIST_DECLARE(entries, 0);
=
pa_hashmap *pa_hashmap_new(pa_hash_func_t hash_func, pa_compare_func_t com=
pare_func) {
pa_hashmap *h;
@@ -88,7 +91,9 @@
h->data[e->hash] =3D e->bucket_next;
}
=
- pa_xfree(e);
+ if (pa_flist_push(PA_STATIC_FLIST_GET(entries), e) < 0)
+ pa_xfree(e);
+ =
h->n_entries--;
}
=
@@ -127,7 +132,9 @@
if ((e =3D get(h, hash, key)))
return -1;
=
- e =3D pa_xnew(struct hashmap_entry, 1);
+ if (!(e =3D pa_flist_pop(PA_STATIC_FLIST_GET(entries))))
+ e =3D pa_xnew(struct hashmap_entry, 1);
+ =
e->hash =3D hash;
e->key =3D key;
e->value =3D value;
More information about the pulseaudio-commits
mailing list