summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2017-09-10 12:57:49 (GMT)
committer Daniel Silverstone <dsilvers@digital-scurf.org>2017-09-10 12:57:49 (GMT)
commitfbebd45ac3204addce4240df475b9565f47df492 (patch)
tree3efbb8469d56ea889b33fd56ad54adde510f47d0
parent00ea402050da45943b1cf1c11d7ac4e1ddbfa489 (diff)
downloadlibnslog-fbebd45ac3204addce4240df475b9565f47df492.tar.gz
libnslog-fbebd45ac3204addce4240df475b9565f47df492.tar.bz2
Change category linking to be cleaner
-rw-r--r--src/core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core.c b/src/core.c
index 95d06c2..b09a002 100644
--- a/src/core.c
+++ b/src/core.c
@@ -52,6 +52,8 @@ const char *nslog_level_name(nslog_level level)
static void nslog__normalise_category(nslog_category_t *cat)
{
+ if (cat->name != NULL)
+ return;
if (cat->parent == NULL) {
cat->name = strdup(cat->cat_name);
cat->namelen = strlen(cat->name);
@@ -61,10 +63,10 @@ static void nslog__normalise_category(nslog_category_t *cat)
strcpy(cat->name, cat->parent->name);
strcat(cat->name, "/");
strcat(cat->name, cat->cat_name);
- cat->next = nslog__all_categories;
cat->namelen = strlen(cat->name);
- nslog__all_categories = cat;
}
+ cat->next = nslog__all_categories;
+ nslog__all_categories = cat;
}
static void nslog__log_corked(nslog_entry_context_t *ctx,