From ef9b0f904259b48f86d9a07b1ff2e68060758768 Mon Sep 17 00:00:00 2001 From: AOA-Mohammed <abdelazi@dmi-cl-login.dmi.unibas.ch> Date: Wed, 12 May 2021 12:41:47 +0200 Subject: [PATCH] move schema_list_sep and schema_path_sep to be defined in i_globals as it is used in core.c and ofi.c --- include/maestro/i_globals.h | 4 +++- maestro/core.c | 13 ++++++------- maestro/ofi.c | 5 ++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/maestro/i_globals.h b/include/maestro/i_globals.h index cec6fbbc..75fab2a9 100644 --- a/include/maestro/i_globals.h +++ b/include/maestro/i_globals.h @@ -163,7 +163,9 @@ extern union mstro_component_descriptor g_component_descriptor; | (MSTRO_POOL_PROTOCOL_VERSION_MINOR << 8) \ | (MSTRO_POOL_PROTOCOL_VERSION_PATCH << 0))) - +/** separators for user defined schema lists and paths enviroment variables */ +#define SCHEMA_LIST_SEP ";" +#define SCHEMA_PATH_SEP ":" /** the precomputed default path for GFS transport (incl. trailing '/') */ extern char *g_mstro_transport_gfs_dir; diff --git a/maestro/core.c b/maestro/core.c index 9a3d5917..7146b022 100644 --- a/maestro/core.c +++ b/maestro/core.c @@ -193,8 +193,7 @@ mstro_status mstro_core_init__setup_schemata(void) { env_schema_path = ""; } - char * schema_list_sep = ";"; - char * schema_path_sep = ":"; + char *schema_list_token; char *schema_path_token; @@ -231,7 +230,7 @@ mstro_status mstro_core_init__setup_schemata(void) char env_schema_path_plus_default[MAX_PATH_LENGTH]; /* get the first schema */ - schema_list_token = strtok_r(env_schema_list, schema_list_sep, &end_list_token); + schema_list_token = strtok_r(env_schema_list, SCHEMA_LIST_SEP, &end_list_token); DEBUG("first schema_list_token: %s \n", schema_list_token); /* walk through other tokens */ @@ -242,10 +241,10 @@ mstro_status mstro_core_init__setup_schemata(void) DEBUG("looking for schema_list_token: %s \n", schema_list_token); // creating list of paths to visit. i.e. current directory "." + user defined paths - snprintf(env_schema_path_plus_default, MAX_PATH_LENGTH, "%s%s%s", ".", schema_path_sep, env_schema_path); + snprintf(env_schema_path_plus_default, MAX_PATH_LENGTH, "%s%s%s", ".", SCHEMA_PATH_SEP, env_schema_path); DEBUG("list of paths for schemas: %s\n", env_schema_path_plus_default); /* get the first path */ - schema_path_token = strtok_r(env_schema_path_plus_default, schema_path_sep, &end_path_token); + schema_path_token = strtok_r(env_schema_path_plus_default, SCHEMA_PATH_SEP, &end_path_token); DEBUG("first schema_path_token: %s\n", schema_path_token); /* walk through other paths */ @@ -262,7 +261,7 @@ mstro_status mstro_core_init__setup_schemata(void) } // read the next path - schema_path_token = strtok_r(NULL, schema_path_sep, &end_path_token); + schema_path_token = strtok_r(NULL, SCHEMA_PATH_SEP, &end_path_token); } @@ -280,7 +279,7 @@ mstro_status mstro_core_init__setup_schemata(void) return status; } // read the next schema name - schema_list_token = strtok_r(NULL, schema_list_sep, &end_list_token); + schema_list_token = strtok_r(NULL, SCHEMA_LIST_SEP, &end_list_token); } return status; diff --git a/maestro/ofi.c b/maestro/ofi.c index 49fb5f1a..06f942cd 100644 --- a/maestro/ofi.c +++ b/maestro/ofi.c @@ -1980,7 +1980,6 @@ mstro_ofi__msg_context_destroy(mstro_ofi_msg_context ctx) /* FIXME check that the schema versions are compatible between the pm and the component */ bool schema_list_compatible_p(const char * component_schema_list, const char * pm_schema_list) { - char * schema_list_sep = ";"; char *schema_name; char *end_list_token; @@ -1996,7 +1995,7 @@ bool schema_list_compatible_p(const char * component_schema_list, const char * p return false; } // split the schema names in the component_schema_list - schema_name = strtok_r(component_schema_list, schema_list_sep, &end_list_token); + schema_name = strtok_r(component_schema_list, SCHEMA_LIST_SEP, &end_list_token); // for each schema name in the component_schema_list ...try to find it in the pm_schema_list while( schema_name != NULL ) { @@ -2008,7 +2007,7 @@ bool schema_list_compatible_p(const char * component_schema_list, const char * p } DEBUG("Found schema %s in %s\n", schema_name, pm_schema_list); // read the next schema name - schema_name = strtok_r(NULL, schema_list_sep, &end_list_token); + schema_name = strtok_r(NULL, SCHEMA_LIST_SEP, &end_list_token); } /*We reach here only if all component schemas were found in the pm_schema_list*/ -- GitLab