Use resource_presence_t in Resource

This commit is contained in:
James Booth
2013-02-10 17:27:08 +00:00
parent e922568770
commit 1a6490a5b7
3 changed files with 10 additions and 18 deletions

View File

@@ -27,17 +27,13 @@
#include <common.h>
#include <resource.h>
Resource * resource_new(const char * const name, const char * const show,
Resource * resource_new(const char * const name, resource_presence_t presence,
const char * const status, const int priority, const char * const caps_str)
{
assert(g_strcmp0(show, "offline") != 0);
assert(name != NULL);
Resource *new_resource = malloc(sizeof(struct resource_t));
new_resource->name = strdup(name);
if (show == NULL || (strcmp(show, "") == 0))
new_resource->show = strdup("online");
else
new_resource->show = strdup(show);
new_resource->presence = presence;
if (status != NULL) {
new_resource->status = strdup(status);
} else {
@@ -57,7 +53,6 @@ void resource_destroy(Resource *resource)
{
assert(resource != NULL);
FREE_SET_NULL(resource->name);
FREE_SET_NULL(resource->show);
FREE_SET_NULL(resource->status);
FREE_SET_NULL(resource->caps_str);
FREE_SET_NULL(resource);