From a529db3430d8dfac2480c3e109a7d80d1f0c3bbd Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 9 May 2022 19:00:52 -0400 Subject: [PATCH] refactor: RUNTIME_MAX_TENANT_COUNT --- runtime/include/tenant.h | 2 -- runtime/src/tenant_database.c | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime/include/tenant.h b/runtime/include/tenant.h index 9abb2dbd..32d93484 100644 --- a/runtime/include/tenant.h +++ b/runtime/include/tenant.h @@ -4,8 +4,6 @@ #include "module_database.h" #include "tcp_server.h" -#define TENANT_DATABASE_CAPACITY 128 - struct tenant { char *name; struct tcp_server tcp_server; diff --git a/runtime/src/tenant_database.c b/runtime/src/tenant_database.c index 77ba49c1..78440721 100644 --- a/runtime/src/tenant_database.c +++ b/runtime/src/tenant_database.c @@ -1,5 +1,6 @@ #include +#include "runtime.h" #include "tenant.h" #include "panic.h" @@ -7,7 +8,7 @@ * Tenant Database * ******************/ -struct tenant *tenant_database[TENANT_DATABASE_CAPACITY] = { NULL }; +struct tenant *tenant_database[RUNTIME_MAX_TENANT_COUNT] = { NULL }; size_t tenant_database_count = 0; /** @@ -18,11 +19,11 @@ size_t tenant_database_count = 0; int tenant_database_add(struct tenant *tenant) { - assert(tenant_database_count <= TENANT_DATABASE_CAPACITY); + assert(tenant_database_count <= RUNTIME_MAX_TENANT_COUNT); int rc; - if (tenant_database_count == TENANT_DATABASE_CAPACITY) goto err_no_space; + if (tenant_database_count == RUNTIME_MAX_TENANT_COUNT) goto err_no_space; tenant_database[tenant_database_count++] = tenant; rc = 0;