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

minor fix

parent 334d86a7
No related branches found
No related tags found
No related merge requests found
......@@ -58,8 +58,6 @@ static void issupervised(char *store, resolve_service_t *ares, unsigned int ares
}
store[strlen(store) - 1] = 0 ;
stralloc_free(&sa) ;
}
void service_graph_build(graph_t *g, resolve_service_t *ares, unsigned int areslen, uint32_t flag)
......
......@@ -21,8 +21,6 @@
#include <oblibs/types.h>
#include <oblibs/stack.h>
#include <skalibs/stralloc.h>
#include <66/service.h>
#include <66/resolve.h>
#include <66/sanitize.h>
......@@ -34,20 +32,19 @@
* STATE_FLAGS_TOPARSE -> call sanitize_source
* STATE_FLAGS_TOPROPAGATE -> it build with the dependencies/requiredby services.
* STATE_FLAGS_ISSUPERVISED -> only keep already supervised service*/
void service_graph_collect(graph_t *g, char const *alist, size_t alen, resolve_service_t *ares, unsigned int *areslen, ssexec_t *info, uint32_t flag)
void service_graph_collect(graph_t *g, char const *slist, size_t slen, resolve_service_t *ares, unsigned int *areslen, ssexec_t *info, uint32_t flag)
{
log_flow () ;
int r ;
size_t pos = 0 ;
ss_state_t ste = STATE_ZERO ;
stralloc sa = STRALLOC_ZERO ;
resolve_wrapper_t_ref wres = 0 ;
for (; pos < alen ; pos += strlen(alist + pos) + 1) {
for (; pos < slen ; pos += strlen(slist + pos) + 1) {
char const *name = alist + pos ;
char const *name = slist + pos ;
if (service_resolve_array_search(ares, (*areslen), name) < 0) {
......@@ -78,7 +75,7 @@ void service_graph_collect(graph_t *g, char const *alist, size_t alen, resolve_s
} else if (FLAGS_ISSET(flag, STATE_FLAGS_TOPARSE)) {
sanitize_source(name, info) ;
sanitize_source(name, info, flag) ;
} else
continue ;
......@@ -132,7 +129,7 @@ void service_graph_collect(graph_t *g, char const *alist, size_t alen, resolve_s
size_t len = strlen(res.sa.s + res.dependencies.depends) ;
_init_stack_(stk, len + 1) ;
if (!stack_convert_string(&stk, res.sa.s + res.dependencies.depends, len))
log_dieu(LOG_EXIT_SYS, "clean string") ;
log_dieusys(LOG_EXIT_SYS, "clean string") ;
service_graph_collect(g, stk.s, stk.len, ares, areslen, info, flag) ;
......@@ -143,7 +140,7 @@ void service_graph_collect(graph_t *g, char const *alist, size_t alen, resolve_s
size_t len = strlen(res.sa.s + res.dependencies.requiredby) ;
_init_stack_(stk, len + 1) ;
if (!stack_convert_string(&stk, res.sa.s + res.dependencies.requiredby, len))
log_dieu(LOG_EXIT_SYS, "clean string") ;
log_dieusys(LOG_EXIT_SYS, "clean string") ;
service_graph_collect(g, stk.s, stk.len, ares, areslen, info, flag) ;
}
......@@ -152,6 +149,4 @@ void service_graph_collect(graph_t *g, char const *alist, size_t alen, resolve_s
resolve_free(wres) ;
}
}
stralloc_free(&sa) ;
}
......@@ -13,20 +13,25 @@
*/
#include <stdint.h>
#include <stdlib.h>
#include <oblibs/log.h>
#include <oblibs/string.h>
#include <oblibs/types.h>
#include <oblibs/stack.h>
#include <66/service.h>
#include <66/graph.h>
#include <66/ssexec.h>
#include <66/state.h>
#include <66/enum.h>
static void debug_flag(uint32_t flag)
{
char req[8 + 10 + 11 + 15 + 9 + 10 + 14 + 6 + 13 + 8 + 10 + 11 + 1] ;
memset(req, 0, sizeof(char) * 126);
char *toinit = "toinit" ;
char *toreload = "toreload" ;
char *torestart = "torestart" ;
......@@ -43,38 +48,38 @@ static void debug_flag(uint32_t flag)
if (FLAGS_ISSET(flag, STATE_FLAGS_TOINIT))
auto_strings(req, toinit) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_TORELOAD))
auto_strings(req, " ", toreload) ;
auto_strings(req + strlen(req), " ", toreload) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_TORESTART))
auto_strings(req, " ", torestart) ;
auto_strings(req + strlen(req), " ", torestart) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_TOUNSUPERVISE))
auto_strings(req, " ", tounsupervise) ;
auto_strings(req + strlen(req), " ", tounsupervise) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_TOPARSE))
auto_strings(req, " ", toparse) ;
auto_strings(req + strlen(req), " ", toparse) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_ISPARSED))
auto_strings(req, " ", isparsed) ;
auto_strings(req + strlen(req), " ", isparsed) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_ISSUPERVISED))
auto_strings(req, " ", issupervised) ;
auto_strings(req + strlen(req), " ", issupervised) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_ISUP))
auto_strings(req, " ", isup) ;
auto_strings(req + strlen(req), " ", isup) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_TOPROPAGATE))
auto_strings(req, " ", topropagate) ;
auto_strings(req + strlen(req), " ", topropagate) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_WANTUP))
auto_strings(req, " ", wantup) ;
auto_strings(req + strlen(req), " ", wantup) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_WANTDOWN))
auto_strings(req, " ", wantdown) ;
auto_strings(req + strlen(req), " ", wantdown) ;
if (FLAGS_ISSET(flag, STATE_FLAGS_ISEARLIER))
auto_strings(req, " ", isearlier) ;
auto_strings(req + strlen(req), " ", isearlier) ;
log_trace("requested flags to build the graph: ", req) ;
}
void service_graph_g(char const *alist, size_t alen, graph_t *graph, resolve_service_t *ares, unsigned int *areslen, ssexec_t *info, uint32_t flag)
void service_graph_g(char const *slist, size_t slen, graph_t *graph, resolve_service_t *ares, unsigned int *areslen, ssexec_t *info, uint32_t flag)
{
log_flow() ;
debug_flag(flag) ;
service_graph_collect(graph, alist, alen, ares, areslen, info, flag) ;
service_graph_collect(graph, slist, slen, ares, areslen, info, flag) ;
if (!*areslen) {
/* avoid empty string */
......
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