Commit 579fb6ec authored by Michael Tremer's avatar Michael Tremer

*_unref: Always expect a valid pointer

Those functions have been very inconsistent in that way that some
happily accepted a NULL pointer and others didn't.
Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 32b16159
......@@ -81,9 +81,6 @@ static void loc_country_list_free(struct loc_country_list* list) {
}
LOC_EXPORT struct loc_country_list* loc_country_list_unref(struct loc_country_list* list) {
if (!list)
return NULL;
if (--list->refcount > 0)
return list;
......
......@@ -103,9 +103,6 @@ LOC_EXPORT struct loc_ctx* loc_ref(struct loc_ctx* ctx) {
}
LOC_EXPORT struct loc_ctx* loc_unref(struct loc_ctx* ctx) {
if (!ctx)
return NULL;
if (--ctx->refcount > 0)
return NULL;
......
......@@ -83,9 +83,6 @@ static void loc_network_list_free(struct loc_network_list* list) {
}
LOC_EXPORT struct loc_network_list* loc_network_list_unref(struct loc_network_list* list) {
if (!list)
return NULL;
if (--list->refcount > 0)
return list;
......
......@@ -116,9 +116,6 @@ static void loc_network_free(struct loc_network* network) {
}
LOC_EXPORT struct loc_network* loc_network_unref(struct loc_network* network) {
if (!network)
return NULL;
if (--network->refcount > 0)
return network;
......@@ -856,9 +853,6 @@ static void loc_network_tree_node_free(struct loc_network_tree_node* node) {
}
struct loc_network_tree_node* loc_network_tree_node_unref(struct loc_network_tree_node* node) {
if (!node)
return NULL;
if (--node->refcount > 0)
return node;
......
......@@ -302,7 +302,6 @@ int main(int argc, char** argv) {
fprintf(stderr, "Could look up 2001:db8:fffe:1::, but I shouldn't\n");
exit(EXIT_FAILURE);
}
loc_network_unref(network1);
const struct bit_length_test {
const char* network;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment