Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Bin He
openairinterface5G
Commits
026b9f6a
Commit
026b9f6a
authored
6 years ago
by
Cédric Roux
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/fix-libconfig' into develop_integration_2018_w36
parents
b0eff6c0
487a599b
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
common/config/config_cmdline.c
+6
-19
6 additions, 19 deletions
common/config/config_cmdline.c
common/config/libconfig/config_libconfig.c
+2
-11
2 additions, 11 deletions
common/config/libconfig/config_libconfig.c
with
8 additions
and
30 deletions
common/config/config_cmdline.c
+
6
−
19
View file @
026b9f6a
...
@@ -142,25 +142,16 @@ char defbool[2]="1";
...
@@ -142,25 +142,16 @@ char defbool[2]="1";
int
config_process_cmdline
(
paramdef_t
*
cfgoptions
,
int
numoptions
,
char
*
prefix
)
int
config_process_cmdline
(
paramdef_t
*
cfgoptions
,
int
numoptions
,
char
*
prefix
)
{
{
int
c
=
config_get_if
()
->
argc
;
int
i
,
j
;
int
c
=
config_get_if
()
->
argc
;
char
*
pp
;
int
i
,
j
;
char
cfgpath
[
512
];
/* 512 should be enough for the sprintf below */
char
*
pp
;
char
*
cfgpath
;
j
=
(
prefix
==
NULL
)
?
0
:
strlen
(
prefix
);
cfgpath
=
malloc
(
j
+
MAX_OPTNAME_SIZE
+
1
);
if
(
cfgpath
==
NULL
)
{
fprintf
(
stderr
,
"[CONFIG] %s %i malloc error, %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
return
-
1
;
}
j
=
0
;
j
=
0
;
i
=
0
;
i
=
0
;
while
(
c
>
0
)
{
while
(
c
>
0
)
{
char
*
oneargv
=
strdup
(
config_get_if
()
->
argv
[
i
]);
/* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
char
*
oneargv
=
strdup
(
config_get_if
()
->
argv
[
i
]);
/* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
/* first check help options, either --help, -h or --help_<section> */
/* first check help options, either --help, -h or --help_<section> */
if
(
strncmp
(
oneargv
,
"-h"
,
2
)
==
0
||
strncmp
(
oneargv
,
"--help"
,
6
)
==
0
)
{
if
(
strncmp
(
oneargv
,
"-h"
,
2
)
==
0
||
strncmp
(
oneargv
,
"--help"
,
6
)
==
0
)
{
char
*
tokctx
;
char
*
tokctx
;
pp
=
strtok_r
(
oneargv
,
"_"
,
&
tokctx
);
pp
=
strtok_r
(
oneargv
,
"_"
,
&
tokctx
);
...
@@ -183,7 +174,7 @@ char *cfgpath;
...
@@ -183,7 +174,7 @@ char *cfgpath;
}
}
}
}
/* now, check for non help options */
/* now, check for non help options */
if
(
oneargv
[
0
]
==
'-'
)
{
if
(
oneargv
[
0
]
==
'-'
)
{
for
(
int
n
=
0
;
n
<
numoptions
;
n
++
)
{
for
(
int
n
=
0
;
n
<
numoptions
;
n
++
)
{
if
(
(
cfgoptions
[
n
].
paramflags
&
PARAMFLAG_DISABLECMDLINE
)
!=
0
)
{
if
(
(
cfgoptions
[
n
].
paramflags
&
PARAMFLAG_DISABLECMDLINE
)
!=
0
)
{
...
@@ -224,9 +215,5 @@ char *cfgpath;
...
@@ -224,9 +215,5 @@ char *cfgpath;
c
--
;
c
--
;
}
/* fin du while */
}
/* fin du while */
printf_cmdl
(
"[CONFIG] %s %i options set from command line
\n
"
,((
prefix
==
NULL
)
?
"(root)"
:
prefix
),
j
);
printf_cmdl
(
"[CONFIG] %s %i options set from command line
\n
"
,((
prefix
==
NULL
)
?
"(root)"
:
prefix
),
j
);
free
(
cfgpath
);
return
j
;
return
j
;
}
/* parse_cmdline*/
}
/* parse_cmdline*/
This diff is collapsed.
Click to expand it.
common/config/libconfig/config_libconfig.c
+
2
−
11
View file @
026b9f6a
...
@@ -91,8 +91,6 @@ int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpat
...
@@ -91,8 +91,6 @@ int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpat
int
config_libconfig_get
(
paramdef_t
*
cfgoptions
,
int
numoptions
,
char
*
prefix
)
int
config_libconfig_get
(
paramdef_t
*
cfgoptions
,
int
numoptions
,
char
*
prefix
)
{
{
config_setting_t
*
setting
;
config_setting_t
*
setting
;
char
*
str
;
char
*
str
;
int
i
,
u
;
int
i
,
u
;
...
@@ -103,15 +101,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
...
@@ -103,15 +101,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
int
notfound
;
int
notfound
;
int
defval
;
int
defval
;
int
fatalerror
=
0
;
int
fatalerror
=
0
;
char
*
cfgpath
;
/* listname.[listindex].paramname */
int
numdefvals
=
0
;
int
numdefvals
=
0
;
char
cfgpath
[
512
];
/* 512 should be enough for the sprintf below */
i
=
(
prefix
==
NULL
)
?
0
:
strlen
(
prefix
);
cfgpath
=
malloc
(
i
+
MAX_OPTNAME_SIZE
+
1
);
if
(
cfgpath
==
NULL
)
{
fprintf
(
stderr
,
"[LIBCONFIG] %s %i malloc error, %s
\n
"
,
__FILE__
,
__LINE__
,
strerror
(
errno
));
return
-
1
;
}
for
(
i
=
0
;
i
<
numoptions
;
i
++
)
{
for
(
i
=
0
;
i
<
numoptions
;
i
++
)
{
if
(
prefix
!=
NULL
)
{
if
(
prefix
!=
NULL
)
{
...
@@ -253,7 +245,6 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
...
@@ -253,7 +245,6 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_libconfig_end
();
config_libconfig_end
();
end_configmodule
();
end_configmodule
();
}
}
free
(
cfgpath
);
return
status
;
return
status
;
}
}
...
...
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