diff options
author | Max Kellermann <max@duempel.org> | 2013-01-07 10:36:27 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-07 10:36:27 +0100 |
commit | 47911f9544ecd3b028cc044b400536234b17949a (patch) | |
tree | 337b28a3679611dd70252f52dd6ad98faf35fdf0 /src/TagPool.cxx | |
parent | 48025c2279c246236aca858f37759726a5d3042c (diff) | |
download | mpd-47911f9544ecd3b028cc044b400536234b17949a.tar.gz mpd-47911f9544ecd3b028cc044b400536234b17949a.tar.xz mpd-47911f9544ecd3b028cc044b400536234b17949a.zip |
tag: convert to C++
Diffstat (limited to '')
-rw-r--r-- | src/TagPool.cxx (renamed from src/tag_pool.c) | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/tag_pool.c b/src/TagPool.cxx index 2f9b39486..ce715a158 100644 --- a/src/tag_pool.c +++ b/src/TagPool.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ */ #include "config.h" -#include "tag_pool.h" +#include "TagPool.hxx" #include <assert.h> @@ -49,7 +49,7 @@ calc_hash_n(enum tag_type type, const char *p, size_t length) { unsigned hash = 5381; - assert(p != NULL); + assert(p != nullptr); while (length-- > 0) hash = (hash << 5) + hash + *p++; @@ -62,7 +62,7 @@ calc_hash(enum tag_type type, const char *p) { unsigned hash = 5381; - assert(p != NULL); + assert(p != nullptr); while (*p != 0) hash = (hash << 5) + hash + *p++; @@ -82,7 +82,8 @@ static struct slot *slot_alloc(struct slot *next, { struct slot *slot; - slot = g_malloc(sizeof(*slot) - sizeof(slot->item.value) + length + 1); + slot = (struct slot *) + g_malloc(sizeof(*slot) - sizeof(slot->item.value) + length + 1); slot->next = next; slot->ref = 1; slot->item.type = type; @@ -97,7 +98,7 @@ tag_pool_get_item(enum tag_type type, const char *value, size_t length) struct slot **slot_p, *slot; slot_p = &slots[calc_hash_n(type, value, length) % NUM_SLOTS]; - for (slot = *slot_p; slot != NULL; slot = slot->next) { + for (slot = *slot_p; slot != nullptr; slot = slot->next) { if (slot->item.type == type && length == strlen(slot->item.value) && memcmp(value, slot->item.value, length) == 0 && @@ -150,7 +151,7 @@ void tag_pool_put_item(struct tag_item *item) for (slot_p = &slots[calc_hash(item->type, item->value) % NUM_SLOTS]; *slot_p != slot; slot_p = &(*slot_p)->next) { - assert(*slot_p != NULL); + assert(*slot_p != nullptr); } *slot_p = slot->next; |