summaryrefslogtreecommitdiffstats
path: root/src/dictionary.c
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2015-12-29 04:21:19 +0200
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2015-12-29 04:21:19 +0200
commitf4456c3d41da3d23520106fdb8b5d9f66267a3cb (patch)
tree25058a9b47510f11acbb05a7241abe68fe105fa1 /src/dictionary.c
parent376187e8363a03245fdf49242596a7e9894850a8 (diff)
fixed minor issues throughout the code (mainly types); dashboard has now a watermark while loading to show it downloads or renders something; a lot of code cleanup in javascript
Diffstat (limited to 'src/dictionary.c')
-rwxr-xr-xsrc/dictionary.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/dictionary.c b/src/dictionary.c
index 033717f51d..31f4d52e19 100755
--- a/src/dictionary.c
+++ b/src/dictionary.c
@@ -40,7 +40,10 @@ static NAME_VALUE *dictionary_name_value_create(DICTIONARY *dict, const char *na
debug(D_DICTIONARY, "Creating name value entry for name '%s', value '%s'.", name, value);
NAME_VALUE *nv = calloc(1, sizeof(NAME_VALUE));
- if(!nv) fatal("Cannot allocate name_value of size %z", sizeof(NAME_VALUE));
+ if(!nv) {
+ fatal("Cannot allocate name_value of size %z", sizeof(NAME_VALUE));
+ exit(1);
+ }
nv->name = strdup(name);
if(!nv->name) fatal("Cannot allocate name_value.name of size %z", strlen(name));
@@ -70,7 +73,10 @@ static void dictionary_name_value_destroy(DICTIONARY *dict, NAME_VALUE *nv) {
else {
NAME_VALUE *n = dict->values;
while(n && n->next && n->next != nv) nv = nv->next;
- if(!n || n->next != nv) fatal("Cannot find name_value with name '%s' in dictionary.", nv->name);
+ if(!n || n->next != nv) {
+ fatal("Cannot find name_value with name '%s' in dictionary.", nv->name);
+ exit(1);
+ }
n->next = nv->next;
nv->next = NULL;
}
@@ -86,7 +92,10 @@ DICTIONARY *dictionary_create(void) {
debug(D_DICTIONARY, "Creating dictionary.");
DICTIONARY *dict = calloc(1, sizeof(DICTIONARY));
- if(!dict) fatal("Cannot allocate DICTIONARY");
+ if(!dict) {
+ fatal("Cannot allocate DICTIONARY");
+ exit(1);
+ }
avl_init(&dict->values_index, name_value_compare);
pthread_rwlock_init(&dict->rwlock, NULL);
@@ -115,7 +124,10 @@ void *dictionary_set(DICTIONARY *dict, const char *name, void *value, size_t val
if(!nv) {
debug(D_DICTIONARY, "Dictionary entry with name '%s' not found. Creating a new one.", name);
nv = dictionary_name_value_create(dict, name, value, value_len);
- if(!nv) fatal("Cannot create name_value.");
+ if(!nv) {
+ fatal("Cannot create name_value.");
+ exit(1);
+ }
return nv->value;
}
else {