Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
38
Issues
38
List
Boards
Labels
Milestones
Merge Requests
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
codes
codes
Commits
13258a3a
Commit
13258a3a
authored
Jan 28, 2014
by
Kevin Harms
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add mulikey support to configuration
parent
c7b1894a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
codes/configuration.h
codes/configuration.h
+18
-0
src/util/configuration.c
src/util/configuration.c
+20
-0
No files found.
codes/configuration.h
View file @
13258a3a
...
...
@@ -72,6 +72,24 @@ int configuration_get_value(ConfigHandle *handle,
char
*
value
,
size_t
length
);
/*
* Get's the values for a give section/key pair which has multiple values.
* Caller's responsible for transforming it to a useable type.
* Assumes the key name is a MULTIKEY configuration type.
*
* handle - configuration handle
* section_name - name of the section the key is in
* key_name - name of the key
* values - array of points to values (must be freed by caller)
* length - number of value items
*/
int
configuration_get_multivalue
(
ConfigHandle
*
handle
,
const
char
*
section_name
,
const
char
*
key_name
,
char
***
values
,
size_t
*
length
);
/*
* Get's the value for a give section/key pair and converts it to an int.
* Assumes the key name is a KEY configuration type.
...
...
src/util/configuration.c
View file @
13258a3a
...
...
@@ -87,6 +87,26 @@ int configuration_get_value(ConfigHandle *handle,
return
rc
;
}
int
configuration_get_multivalue
(
ConfigHandle
*
handle
,
const
char
*
section_name
,
const
char
*
key_name
,
char
***
values
,
size_t
*
len
)
{
SectionHandle
section_handle
;
int
rc
;
rc
=
cf_openSection
(
*
handle
,
ROOT_SECTION
,
section_name
,
&
section_handle
);
assert
(
rc
==
1
);
rc
=
cf_getMultiKey
(
*
handle
,
section_handle
,
key_name
,
values
,
len
);
assert
(
rc
);
(
void
)
cf_closeSection
(
*
handle
,
section_handle
);
return
rc
;
}
int
configuration_get_value_int
(
ConfigHandle
*
handle
,
const
char
*
section_name
,
const
char
*
key_name
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment