diff --git a/src/lib66/environ/env_append_version.c b/src/lib66/environ/env_append_version.c index 323070e5ddcd5c9a6f465603eee9660999ed3ea0..75fd63ce45baf2ffbf2cd2398b8d54e54b268b3c 100644 --- a/src/lib66/environ/env_append_version.c +++ b/src/lib66/environ/env_append_version.c @@ -28,21 +28,17 @@ int env_append_version(stralloc *saversion, char const *svconf, char const *vers int r ; - stralloc sa = STRALLOC_ZERO ; + _alloc_stk_(stk, strlen(version) + 1) ; - if (!env_check_version(&sa,version)) + if (!env_check_version(&stk,version)) return 0 ; - saversion->len = 0 ; - - if (!auto_stra(saversion,svconf,"/",sa.s)) + if (!auto_stra(saversion,svconf,"/",stk.s)) log_warnusys_return(LOG_EXIT_ZERO,"stralloc") ; r = scan_mode(saversion->s,S_IFDIR) ; if (r == -1 || !r) log_warnusys_return(LOG_EXIT_ZERO,"find the versioned directory: ",saversion->s) ; - stralloc_free(&sa) ; - return 1 ; } diff --git a/src/lib66/environ/env_check_version.c b/src/lib66/environ/env_check_version.c index 9288eb75a72864c7234a3898725769d335705c9c..ce55f5c7eceb4ba8dae825988452baf91fa5ce45 100644 --- a/src/lib66/environ/env_check_version.c +++ b/src/lib66/environ/env_check_version.c @@ -14,23 +14,22 @@ #include <oblibs/log.h> #include <oblibs/string.h> - -#include <skalibs/stralloc.h> +#include <oblibs/stack.h> #include <66/environ.h> #include <66/constants.h> #include <66/utils.h> -int env_check_version(stralloc *sa, char const *version) +int env_check_version(stack *stk, char const *version) { log_flow() ; int r ; - r = version_store(sa,version,SS_CONFIG_VERSION_NDOT) ; + r = version_store(stk,version,SS_CONFIG_VERSION_NDOT) ; if (r == -1) - log_warnusys_return(LOG_EXIT_ZERO,"stralloc") ; + log_warnusys_return(LOG_EXIT_ZERO,"stack") ; if (!r) log_warn_return(LOG_EXIT_ZERO,"invalid version format: ",version) ; diff --git a/src/lib66/parse/parse_store_main.c b/src/lib66/parse/parse_store_main.c index 61c8e4b09812eb19d4fc6a0ac4e6ec63a6ba0fa5..15c562a39ac6d4f75763f5e8d749ec196c76d0ec 100644 --- a/src/lib66/parse/parse_store_main.c +++ b/src/lib66/parse/parse_store_main.c @@ -52,19 +52,14 @@ int parse_store_main(resolve_service_t *res, stack *store, int idsec, int idkey) case KEY_MAIN_VERSION: { - stralloc sa = STRALLOC_ZERO ; - if (!auto_stra(&sa, store->s)) - goto err ; - - r = version_store(&sa, store->s, SS_CONFIG_VERSION_NDOT) ; + r = version_store(store, store->s, SS_CONFIG_VERSION_NDOT) ; if (r == -1) goto err ; if (!r) parse_error_return(0, 0, idsec, idkey) ; - res->version = resolve_add_string(wres, sa.s) ; - stralloc_free(&sa) ; + res->version = resolve_add_string(wres, store->s) ; } break ;