1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Use null check convention in resource.c

This commit is contained in:
James Booth 2015-05-04 23:29:53 +01:00
parent 0930f0f688
commit 59788752c7

View File

@ -46,7 +46,7 @@ Resource * resource_new(const char * const name, resource_presence_t presence,
Resource *new_resource = malloc(sizeof(struct resource_t)); Resource *new_resource = malloc(sizeof(struct resource_t));
new_resource->name = strdup(name); new_resource->name = strdup(name);
new_resource->presence = presence; new_resource->presence = presence;
if (status != NULL) { if (status) {
new_resource->status = strdup(status); new_resource->status = strdup(status);
} else { } else {
new_resource->status = NULL; new_resource->status = NULL;
@ -88,7 +88,7 @@ resource_compare_availability(Resource *first, Resource *second)
void resource_destroy(Resource *resource) void resource_destroy(Resource *resource)
{ {
if (resource != NULL) { if (resource) {
free(resource->name); free(resource->name);
free(resource->status); free(resource->status);
free(resource); free(resource);