summaryrefslogtreecommitdiffstats
path: root/polyp/props.c
diff options
context:
space:
mode:
Diffstat (limited to 'polyp/props.c')
-rw-r--r--polyp/props.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/polyp/props.c b/polyp/props.c
index 1046551b..df748c1e 100644
--- a/polyp/props.c
+++ b/polyp/props.c
@@ -25,17 +25,17 @@
#include "props.h"
#include "log.h"
-struct pa_property {
+typedef struct pa_property {
char *name; /* Points to memory allocated by the property subsystem */
void *data; /* Points to memory maintained by the caller */
-};
+} pa_property;
/* Allocate a new property object */
-static struct pa_property* property_new(const char *name, void *data) {
- struct pa_property* p;
+static pa_property* property_new(const char *name, void *data) {
+ pa_property* p;
assert(name && data);
- p = pa_xmalloc(sizeof(struct pa_property));
+ p = pa_xmalloc(sizeof(pa_property));
p->name = pa_xstrdup(name);
p->data = data;
@@ -43,15 +43,15 @@ static struct pa_property* property_new(const char *name, void *data) {
}
/* Free a property object */
-static void property_free(struct pa_property *p) {
+static void property_free(pa_property *p) {
assert(p);
pa_xfree(p->name);
pa_xfree(p);
}
-void* pa_property_get(struct pa_core *c, const char *name) {
- struct pa_property *p;
+void* pa_property_get(pa_core *c, const char *name) {
+ pa_property *p;
assert(c && name && c->properties);
if (!(p = pa_hashmap_get(c->properties, name)))
@@ -60,8 +60,8 @@ void* pa_property_get(struct pa_core *c, const char *name) {
return p->data;
}
-int pa_property_set(struct pa_core *c, const char *name, void *data) {
- struct pa_property *p;
+int pa_property_set(pa_core *c, const char *name, void *data) {
+ pa_property *p;
assert(c && name && data && c->properties);
if (pa_hashmap_get(c->properties, name))
@@ -72,8 +72,8 @@ int pa_property_set(struct pa_core *c, const char *name, void *data) {
return 0;
}
-int pa_property_remove(struct pa_core *c, const char *name) {
- struct pa_property *p;
+int pa_property_remove(pa_core *c, const char *name) {
+ pa_property *p;
assert(c && name && c->properties);
if (!(p = pa_hashmap_remove(c->properties, name)))
@@ -83,35 +83,35 @@ int pa_property_remove(struct pa_core *c, const char *name) {
return 0;
}
-void pa_property_init(struct pa_core *c) {
+void pa_property_init(pa_core *c) {
assert(c);
c->properties = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
}
-void pa_property_cleanup(struct pa_core *c) {
+void pa_property_cleanup(pa_core *c) {
assert(c);
if (!c->properties)
return;
- assert(!pa_hashmap_ncontents(c->properties));
+ assert(!pa_hashmap_size(c->properties));
pa_hashmap_free(c->properties, NULL, NULL);
c->properties = NULL;
}
-void pa_property_dump(struct pa_core *c, struct pa_strbuf *s) {
+void pa_property_dump(pa_core *c, pa_strbuf *s) {
void *state = NULL;
- struct pa_property *p;
+ pa_property *p;
assert(c && s);
while ((p = pa_hashmap_iterate(c->properties, &state, NULL)))
pa_strbuf_printf(s, "[%s] -> [%p]\n", p->name, p->data);
}
-int pa_property_replace(struct pa_core *c, const char *name, void *data) {
+int pa_property_replace(pa_core *c, const char *name, void *data) {
assert(c && name);
pa_property_remove(c, name);