summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3970ba2)
raw | patch | inline | side by side (parent: 3970ba2)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 20 Apr 2014 10:05:57 +0000 (12:05 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 20 Apr 2014 10:05:57 +0000 (12:05 +0200) |
This ensures consistent handling of reference counts.
src/core/plugin.c | patch | blob | history |
diff --git a/src/core/plugin.c b/src/core/plugin.c
index 929abaee8467cf4bc7f419c324cdd7c6b46a339f..7584aa54d273bf0fce16ad7dd81f593a4e3ac7f0 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
ctx_destroy
};
-static ctx_t *
-ctx_create(const char *name)
-{
- ctx_t *ctx;
-
- ctx = CTX(sdb_object_create(name, ctx_type));
- if (! ctx)
- return NULL;
-
- if (! plugin_ctx_key_initialized)
- ctx_key_init();
- sdb_object_ref(SDB_OBJ(ctx));
- pthread_setspecific(plugin_ctx_key, ctx);
- return ctx;
-} /* ctx_create */
-
static ctx_t *
ctx_get(void)
{
return old;
} /* ctx_set */
+static ctx_t *
+ctx_create(const char *name)
+{
+ ctx_t *ctx;
+
+ ctx = CTX(sdb_object_create(name, ctx_type));
+ if (! ctx)
+ return NULL;
+
+ if (! plugin_ctx_key_initialized)
+ ctx_key_init();
+ ctx_set(ctx);
+ return ctx;
+} /* ctx_create */
+
static int
plugin_cb_init(sdb_object_t *obj, va_list ap)
{