Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
6
66
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Vidal
66
Commits
182a8e6d
Commit
182a8e6d
authored
3 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
please freed the graph framboise!
parent
3fb4d462
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/66/66-inservice.c
+13
-107
13 additions, 107 deletions
src/66/66-inservice.c
src/66/66-intree.c
+7
-42
7 additions, 42 deletions
src/66/66-intree.c
with
20 additions
and
149 deletions
src/66/66-inservice.c
+
13
−
107
View file @
182a8e6d
...
...
@@ -340,32 +340,12 @@ static void info_display_live(char const *field,resolve_service_t *res)
if
(
NOFIELD
)
info_display_field_name
(
field
)
;
info_display_string
(
res
->
sa
.
s
+
res
->
runat
)
;
}
/*
int graph_service_compute_deps(stralloc *deps, char const *str)
{
stralloc tmp = STRALLOC_ZERO ;
size_t pos = 0 ;
if (!sastr_clean_string(&tmp,str))
log_warnu_return(LOG_EXIT_ZERO,"rebuild dependencies list") ;
FOREACH_SASTR(&tmp,pos) {
if (!sastr_add_string(deps, tmp.s + pos))
return 0 ;
}
stralloc_free(&tmp) ;
return 1 ;
}
*/
/**
*
*
* bugged function
*
*
void ss_graph_matrix_add_classic(graph_t *g, genalloc *gares)
{
size_t pos = 0, bpos = 0, ccount = 0 ;
...
...
@@ -388,7 +368,7 @@ void ss_graph_matrix_add_classic(graph_t *g, genalloc *gares)
char *str = genalloc_s(resolve_service_t, gares)[cl[pos]].sa.s ;
char *sv = str + genalloc_s(resolve_service_t, gares)[cl[pos]].name ;
printf
(
"sv::%s
\n
"
,
sv
)
;
graph_array_reverse(g->sort, g->sort_count) ;
for (bpos = 0 ; bpos < g->sort_count ; bpos++) {
...
...
@@ -420,84 +400,7 @@ printf("sv::%s\n",sv) ;
}
}
/** what = 0 -> only classic
* what = 1 -> only atomic
* what = 2 -> both
* @Return 0 on fail
*
* This function append the logger to @gares is case of classic service. */
int
ss_tree_get_sv_resolve
(
genalloc
*
gares
,
char
const
*
dir
,
uint8_t
what
)
{
log_flow
()
;
stralloc
sa
=
STRALLOC_ZERO
;
resolve_service_t
res
=
RESOLVE_SERVICE_ZERO
;
resolve_wrapper_t_ref
wres
=
resolve_set_struct
(
SERVICE_STRUCT
,
&
res
)
;
resolve_service_t
reslog
=
RESOLVE_SERVICE_ZERO
;
resolve_wrapper_t_ref
wreslog
=
resolve_set_struct
(
SERVICE_STRUCT
,
&
reslog
)
;
int
e
=
0
;
size_t
dirlen
=
strlen
(
dir
),
pos
=
0
;
char
solve
[
dirlen
+
SS_RESOLVE_LEN
+
1
]
;
auto_strings
(
solve
,
dir
,
SS_RESOLVE
)
;
char
const
*
exclude
[
2
]
=
{
SS_MASTER
+
1
,
0
}
;
if
(
!
sastr_dir_get
(
&
sa
,
solve
,
exclude
,
S_IFREG
))
goto
err
;
FOREACH_SASTR
(
&
sa
,
pos
)
{
char
*
name
=
sa
.
s
+
pos
;
if
(
!
resolve_check
(
dir
,
name
))
goto
err
;
if
(
!
resolve_read
(
wres
,
dir
,
name
))
goto
err
;
if
(
resolve_search
(
gares
,
name
,
SERVICE_STRUCT
)
==
-
1
)
{
if
((
!
what
||
what
==
2
)
&&
(
res
.
type
==
TYPE_CLASSIC
))
{
if
(
res
.
logger
)
{
if
(
!
resolve_read
(
wreslog
,
dir
,
res
.
sa
.
s
+
res
.
logger
))
goto
err
;
if
(
resolve_search
(
gares
,
res
.
sa
.
s
+
res
.
logger
,
SERVICE_STRUCT
)
==
-
1
)
{
if
(
!
resolve_append
(
gares
,
wreslog
))
goto
err
;
}
}
if
(
!
resolve_append
(
gares
,
wres
))
goto
err
;
continue
;
}
if
(
what
)
{
if
(
!
resolve_append
(
gares
,
wres
))
goto
err
;
}
}
}
e
=
1
;
err:
stralloc_free
(
&
sa
)
;
resolve_free
(
wres
)
;
resolve_free
(
wreslog
)
;
return
e
;
}
*/
static
void
info_display_requiredby
(
char
const
*
field
,
resolve_service_t
*
res
)
{
...
...
@@ -530,7 +433,7 @@ static void info_display_requiredby(char const *field, resolve_service_t *res)
if
(
!
info_walk
(
&
graph
,
res
->
sa
.
s
+
res
->
name
,
res
->
sa
.
s
+
res
->
treename
,
&
info_graph_display_service
,
1
,
REVERSE
,
&
d
,
padding
,
STYLE
))
log_dieu
(
LOG_EXIT_SYS
,
"display the requiredby list"
)
;
return
;
goto
freed
;
}
else
{
...
...
@@ -548,7 +451,7 @@ static void info_display_requiredby(char const *field, resolve_service_t *res)
info_display_list
(
field
,
&
deps
)
;
return
;
goto
freed
;
}
empty:
...
...
@@ -564,6 +467,8 @@ static void info_display_requiredby(char const *field, resolve_service_t *res)
if
(
!
bprintf
(
buffer_1
,
"%s%s%s
\n
"
,
log_color
->
warning
,
"None"
,
log_color
->
off
))
log_dieusys
(
LOG_EXIT_SYS
,
"write to stdout"
)
;
}
freed:
graph_free_all
(
&
graph
)
;
}
static
void
info_display_deps
(
char
const
*
field
,
resolve_service_t
*
res
)
...
...
@@ -634,6 +539,7 @@ static void info_display_deps(char const *field, resolve_service_t *res)
}
freed:
graph_free_all
(
&
graph
)
;
stralloc_free
(
&
deps
)
;
}
...
...
This diff is collapsed.
Click to expand it.
src/66/66-intree.c
+
7
−
42
View file @
182a8e6d
...
...
@@ -222,33 +222,6 @@ static void info_display_order(char const *field,char const *treename)
stralloc_free
(
&
tmp
)
;
}
static
void
info_get_graph_src
(
ss_resolve_graph_t
*
graph
,
char
const
*
src
,
unsigned
int
reverse
)
{
size_t
srclen
=
strlen
(
src
),
pos
;
stralloc
sa
=
STRALLOC_ZERO
;
genalloc
gares
=
GENALLOC_ZERO
;
char
const
*
exclude
[
2
]
=
{
SS_MASTER
+
1
,
0
}
;
char
solve
[
srclen
+
SS_RESOLVE_LEN
+
1
]
;
memcpy
(
solve
,
src
,
srclen
)
;
memcpy
(
solve
+
srclen
,
SS_RESOLVE
,
SS_RESOLVE_LEN
)
;
solve
[
srclen
+
SS_RESOLVE_LEN
]
=
0
;
if
(
!
sastr_dir_get
(
&
sa
,
solve
,
exclude
,
S_IFREG
))
log_dieusys
(
LOG_EXIT_SYS
,
"get source service file at: "
,
solve
)
;
if
(
!
service_resolve_sort_bytype
(
&
gares
,
&
sa
,
src
))
log_dieu
(
LOG_EXIT_SYS
,
"sort list by type"
)
;
for
(
pos
=
0
;
pos
<
genalloc_len
(
resolve_service_t
,
&
gares
)
;
pos
++
)
if
(
!
ss_resolve_graph_build
(
graph
,
&
genalloc_s
(
resolve_service_t
,
&
gares
)[
pos
],
src
,
reverse
))
log_dieu
(
LOG_EXIT_SYS
,
"build the graph from: "
,
src
)
;
resolve_deep_free
(
SERVICE_STRUCT
,
&
gares
)
;
stralloc_free
(
&
sa
)
;
}
static
void
info_display_allow
(
char
const
*
field
,
char
const
*
treename
)
{
if
(
NOFIELD
)
info_display_field_name
(
field
)
;
...
...
@@ -321,7 +294,7 @@ static void info_display_symlink(char const *field, char const *treename)
static
void
info_display_contents
(
char
const
*
field
,
char
const
*
treename
)
{
int
r
;
size_t
padding
=
1
,
treenamelen
=
strlen
(
treename
)
;
graph_t
graph
=
GRAPH_ZERO
;
stralloc
sa
=
STRALLOC_ZERO
;
...
...
@@ -336,7 +309,8 @@ static void info_display_contents(char const *field, char const *treename)
if
(
!
graph_service_build_bytree
(
&
graph
,
tmp
,
2
))
log_dieu
(
LOG_EXIT_SYS
,
"build the graph dependencies"
)
;
graph_matrix_sort_tosa
(
&
sa
,
&
graph
)
;
if
(
!
graph_matrix_sort_tosa
(
&
sa
,
&
graph
))
log_dieu
(
LOG_EXIT_SYS
,
"get the dependencies list"
)
;
if
(
!
sa
.
len
)
goto
empty
;
...
...
@@ -354,18 +328,11 @@ static void info_display_contents(char const *field, char const *treename)
}
else
{
r
=
graph_matrix_sort_tosa
(
&
deps
,
&
graph
)
;
if
(
!
r
)
log_dieu
(
LOG_EXIT_SYS
,
"get the dependencies list"
)
;
if
(
!
deps
.
len
)
goto
empty
;
if
(
REVERSE
)
if
(
!
sastr_reverse
(
&
dep
s
))
if
(
!
sastr_reverse
(
&
s
a
))
log_dieu
(
LOG_EXIT_SYS
,
"reverse the dependencies list"
)
;
info_display_list
(
field
,
&
dep
s
)
;
info_display_list
(
field
,
&
s
a
)
;
goto
freed
;
}
...
...
@@ -385,10 +352,8 @@ static void info_display_contents(char const *field, char const *treename)
}
freed:
stralloc_free
(
&
deps
)
;
graph_free_all
(
&
graph
)
;
stralloc_free
(
&
sa
)
;
}
static
void
info_display_all
(
char
const
*
treename
,
int
*
what
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment