Skip to content
Snippets Groups Projects
Commit 03a7108c authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

less HEAP memory usage

parent 53d16a5a
No related branches found
No related tags found
No related merge requests found
......@@ -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 ;
}
......@@ -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) ;
......
......@@ -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 ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment