aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJulien Dessaux2019-09-12 18:01:14 +0200
committerJulien Dessaux2019-09-12 18:01:14 +0200
commit0bc24859aeca6a4e0d34f05b60b27250b1253ddd (patch)
tree4aeb8a1c304a80d4ed7c18491fde2e5d54b47451 /common
parentFixed code flow with memory free (diff)
downloadrocket-cli-client-0bc24859aeca6a4e0d34f05b60b27250b1253ddd.tar.gz
rocket-cli-client-0bc24859aeca6a4e0d34f05b60b27250b1253ddd.tar.bz2
rocket-cli-client-0bc24859aeca6a4e0d34f05b60b27250b1253ddd.zip
Changed subscription id to rid
Diffstat (limited to 'common')
-rw-r--r--common/subscriptions.c14
-rw-r--r--common/subscriptions.h4
2 files changed, 9 insertions, 9 deletions
diff --git a/common/subscriptions.c b/common/subscriptions.c
index 0874cb0..9c8c345 100644
--- a/common/subscriptions.c
+++ b/common/subscriptions.c
@@ -1,16 +1,16 @@
#include "subscriptions.h"
-void common_subscription_add(struct subscription** subscriptions, const char* id, const char* name, enum subscription_type type, size_t unread)
+void common_subscription_add(struct subscription** subscriptions, const char* rid, const char* name, enum subscription_type type, size_t unread)
{
- struct subscription * subscription = common_subscription_new(id, name, type, unread);
- HASH_ADD_KEYPTR(hh, *subscriptions, subscription->id, strlen(id), subscription);
+ struct subscription * subscription = common_subscription_new(rid, name, type, unread);
+ HASH_ADD_KEYPTR(hh, *subscriptions, subscription->rid, strlen(rid), subscription);
}
-struct subscription* common_subscription_new(const char* id, const char* name, enum subscription_type type, size_t unread)
+struct subscription* common_subscription_new(const char* rid, const char* name, enum subscription_type type, size_t unread)
{
struct subscription* subscription = malloc(sizeof(struct subscription));
- subscription->id = malloc(strlen(id) + 1);
- strcpy(subscription->id, id);
+ subscription->rid = malloc(strlen(rid) + 1);
+ strcpy(subscription->rid, rid);
subscription->name = malloc(strlen(name) + 1);
strcpy(subscription->name, name);
subscription->type = type;
@@ -24,7 +24,7 @@ void common_subscriptions_free(struct subscription* subscriptions)
HASH_ITER(hh, subscriptions, sub, tmp) {
HASH_DEL(subscriptions, sub);
- free(sub->id);
+ free(sub->rid);
free(sub->name);
free(sub);
}
diff --git a/common/subscriptions.h b/common/subscriptions.h
index a152345..0ade221 100644
--- a/common/subscriptions.h
+++ b/common/subscriptions.h
@@ -14,7 +14,7 @@ enum subscription_type {
};
struct subscription {
- char* id;
+ char* rid;
char* name;
enum subscription_type type;
size_t unread;
@@ -22,7 +22,7 @@ struct subscription {
};
void common_subscription_add(struct subscription** subscriptions, const char* id, const char* name, enum subscription_type type, size_t unread);
-struct subscription* common_subscription_new(const char* id, const char* name, enum subscription_type type, size_t unread);
+struct subscription* common_subscription_new(const char* rid, const char* name, enum subscription_type type, size_t unread);
void common_subscriptions_free(struct subscription* subscriptions);
void common_subscriptions_const_walk(const struct subscription* subscriptions, void (*func)(const struct subscription*));