Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
4d1eedba
Commit
4d1eedba
authored
Apr 13, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: added function config_get_unsigned()
parent
6a958980
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
conf.c
src/conf.c
+17
-0
conf.h
src/conf.h
+4
-0
No files found.
src/conf.c
View file @
4d1eedba
...
@@ -504,6 +504,23 @@ config_get_path(const char *name)
...
@@ -504,6 +504,23 @@ config_get_path(const char *name)
}
}
unsigned
unsigned
config_get_unsigned
(
const
char
*
name
,
unsigned
default_value
)
{
const
struct
config_param
*
param
=
config_get_param
(
name
);
long
value
;
char
*
endptr
;
if
(
param
==
NULL
)
return
default_value
;
value
=
strtol
(
param
->
value
,
&
endptr
,
0
);
if
(
*
endptr
!=
0
||
value
<
0
)
g_error
(
"Not a valid non-negative number in line %i"
,
param
->
line
);
return
(
unsigned
)
value
;
}
unsigned
config_get_positive
(
const
char
*
name
,
unsigned
default_value
)
config_get_positive
(
const
char
*
name
,
unsigned
default_value
)
{
{
const
struct
config_param
*
param
=
config_get_param
(
name
);
const
struct
config_param
*
param
=
config_get_param
(
name
);
...
...
src/conf.h
View file @
4d1eedba
...
@@ -164,6 +164,10 @@ config_get_path(const char *name);
...
@@ -164,6 +164,10 @@ config_get_path(const char *name);
G_GNUC_PURE
G_GNUC_PURE
unsigned
unsigned
config_get_unsigned
(
const
char
*
name
,
unsigned
default_value
);
G_GNUC_PURE
unsigned
config_get_positive
(
const
char
*
name
,
unsigned
default_value
);
config_get_positive
(
const
char
*
name
,
unsigned
default_value
);
G_GNUC_PURE
G_GNUC_PURE
...
...
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