Browse Source

Remove redundant store type check.

Stefano Cossu 1 year ago
parent
commit
dd3fa57548
1 changed files with 4 additions and 11 deletions
  1. 4 11
      src/graph.c

+ 4 - 11
src/graph.c

@@ -55,7 +55,10 @@ LSUP_graph_new (
                 "Environment is not initialized. Did you call LSUP_init()?");
         return NULL;
     }
-    if (UNLIKELY (!check_backend (store_type))) return NULL;
+    if (UNLIKELY (!check_backend (store_type))) {
+        log_error ("Not a valid store type: %d", store_type);
+        return NULL;
+    }
 
     LSUP_Graph *gr;
     MALLOC_GUARD (gr, NULL);
@@ -65,16 +68,6 @@ LSUP_graph_new (
 
     gr->store->type = store_type;
     gr->store->id = store_id ? strdup (store_id) : NULL;
-
-    switch (gr->store->type) {
-#define ENTRY(a, b) \
-        case LSUP_STORE_##a: gr->store->sif = &b; break;
-BACKEND_TBL
-#undef ENTRY
-        default:
-            log_error ("Not a valid store type: %d", store_type); return NULL;
-    };
-
     // TODO implement custom default context.
     gr->store->data = gr->store->sif->new_fn (store_id, size);