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
0b9a7996
Commit
0b9a7996
authored
5 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
remove insta_? deprecated function
parent
268794e2
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/include/66/utils.h
+0
-5
0 additions, 5 deletions
src/include/66/utils.h
src/lib66/instance.c
+0
-131
0 additions, 131 deletions
src/lib66/instance.c
with
0 additions
and
136 deletions
src/include/66/utils.h
+
0
−
5
View file @
0b9a7996
...
...
@@ -20,7 +20,6 @@
#include
<skalibs/stralloc.h>
#include
<skalibs/genalloc.h>
#include
<skalibs/gccattributes.h>
#include
<66/ssexec.h>
#include
<66/resolve.h>
...
...
@@ -48,10 +47,6 @@ extern int set_livedir(stralloc *live) ;
extern
int
set_livescan
(
stralloc
*
live
,
uid_t
owner
)
;
extern
int
set_livetree
(
stralloc
*
live
,
uid_t
owner
)
;
extern
int
set_livestate
(
stralloc
*
live
,
uid_t
owner
)
;
extern
int
insta_check
(
char
const
*
svname
)
gccattr_deprecated
;
extern
int
insta_create
(
stralloc
*
sasv
,
stralloc
*
sv
,
char
const
*
src
,
int
len
)
gccattr_deprecated
;
extern
int
insta_splitname
(
stralloc
*
sa
,
char
const
*
name
,
int
len
,
int
what
)
gccattr_deprecated
;
extern
int
insta_replace
(
stralloc
*
sa
,
char
const
*
src
,
char
const
*
cpy
)
gccattr_deprecated
;
extern
int
read_svfile
(
stralloc
*
sasv
,
char
const
*
name
,
char
const
*
src
)
;
extern
int
instance_check
(
char
const
*
svname
)
;
extern
int
instance_splitname
(
stralloc
*
sa
,
char
const
*
name
,
int
len
,
int
what
)
;
...
...
This diff is collapsed.
Click to expand it.
src/lib66/instance.c
+
0
−
131
View file @
0b9a7996
...
...
@@ -89,134 +89,3 @@ int instance_create(stralloc *sasv,char const *svname, char const *regex, char c
stralloc_free
(
&
tmp
)
;
return
0
;
}
/*********************
* Deprecated function
* *******************/
int
insta_replace
(
stralloc
*
sa
,
char
const
*
src
,
char
const
*
cpy
)
{
int
curr
,
count
;
if
(
!
src
||
!*
src
)
return
0
;
size_t
len
=
strlen
(
src
)
;
size_t
clen
=
strlen
(
cpy
)
;
curr
=
count
=
0
;
for
(
int
i
=
0
;
(
size_t
)
i
<
len
;
i
++
)
if
(
src
[
i
]
==
'@'
)
count
++
;
size_t
resultlen
=
len
+
(
clen
*
count
)
;
char
result
[
resultlen
+
1
]
;
for
(
int
i
=
0
;
(
size_t
)
i
<
len
;
i
++
)
{
if
(
src
[
i
]
==
'@'
)
{
if
(((
size_t
)
i
+
1
)
==
len
)
break
;
if
(
src
[
i
+
1
]
==
'I'
)
{
memcpy
(
result
+
curr
,
cpy
,
clen
)
;
curr
=
curr
+
clen
;
i
=
i
+
2
;
}
}
result
[
curr
++
]
=
src
[
i
]
;
}
result
[
curr
]
=
0
;
sa
->
len
=
0
;
if
(
!
stralloc_cats
(
sa
,
result
)
||
!
stralloc_0
(
sa
))
return
0
;
return
1
;
}
/** instance -> 0, copy -> 1 */
int
insta_splitname
(
stralloc
*
sa
,
char
const
*
name
,
int
len
,
int
what
)
{
char
const
*
copy
;
size_t
tlen
=
len
+
1
;
char
template
[
tlen
+
1
]
;
memcpy
(
template
,
name
,
tlen
)
;
template
[
tlen
]
=
0
;
copy
=
name
+
tlen
;
sa
->
len
=
0
;
if
(
!
what
)
if
(
!
stralloc_cats
(
sa
,
template
)
||
!
stralloc_0
(
sa
))
return
0
;
else
if
(
!
stralloc_catb
(
sa
,
copy
,
strlen
(
copy
))
||
!
stralloc_0
(
sa
))
return
0
;
return
1
;
}
int
insta_create
(
stralloc
*
sasv
,
stralloc
*
sv
,
char
const
*
src
,
int
len
)
{
char
*
fdtmp
;
char
const
*
copy
;
size_t
tlen
=
len
+
1
;
stralloc
sa
=
STRALLOC_ZERO
;
stralloc
tmp
=
STRALLOC_ZERO
;
char
template
[
tlen
+
1
]
;
memcpy
(
template
,
sv
->
s
,
tlen
)
;
template
[
tlen
]
=
0
;
copy
=
sv
->
s
+
tlen
;
fdtmp
=
dir_create_tmp
(
&
tmp
,
"/tmp"
,
copy
)
;
if
(
!
fdtmp
)
{
VERBO3
strerr_warnwu1x
(
"create instance tmp dir"
)
;
return
0
;
}
if
(
!
file_readputsa
(
&
sa
,
src
,
template
)){
VERBO3
strerr_warnwu4sys
(
"open: "
,
src
,
"/"
,
template
)
;
return
0
;
}
if
(
!
insta_replace
(
&
sa
,
sa
.
s
,
copy
)){
VERBO3
strerr_warnwu2x
(
"replace instance character at: "
,
sa
.
s
)
;
return
0
;
}
/** remove the last \0 */
sa
.
len
--
;
if
(
!
file_write_unsafe
(
tmp
.
s
,
copy
,
sa
.
s
,
sa
.
len
)){
VERBO3
strerr_warnwu4sys
(
"create instance service file: "
,
tmp
.
s
,
"/"
,
copy
)
;
return
0
;
}
if
(
!
read_svfile
(
sasv
,
copy
,
tmp
.
s
))
return
0
;
if
(
rm_rf
(
tmp
.
s
)
<
0
){
VERBO3
strerr_warnwu2x
(
"remove tmp directory: "
,
tmp
.
s
)
;
return
0
;
}
stralloc_free
(
&
sa
)
;
stralloc_free
(
&
tmp
)
;
sv
->
len
=
0
;
if
(
!
stralloc_catb
(
sv
,
copy
,
strlen
(
copy
))
||
!
stralloc_0
(
sv
))
return
0
;
return
1
;
}
int
insta_check
(
char
const
*
svname
)
{
int
r
;
r
=
get_len_until
(
svname
,
'@'
)
;
if
(
r
<
0
)
return
-
1
;
return
r
;
}
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