git.openpandora.org
/
pandora-libraries.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Added _get_as_int_d function, which is same as _get_as_int but with default value...
[pandora-libraries.git]
/
lib
/
pnd_conf.c
diff --git
a/lib/pnd_conf.c
b/lib/pnd_conf.c
index
e2114a5
..
5f1901f
100644
(file)
--- a/
lib/pnd_conf.c
+++ b/
lib/pnd_conf.c
@@
-257,3
+257,15
@@
int pnd_conf_get_as_int ( pnd_conf_handle c, char *key ) {
return ( i );
}
+
+int pnd_conf_get_as_int_d ( pnd_conf_handle c, char *key, int def ) {
+ char *t = pnd_box_find_by_key ( c, key );
+
+ if ( ! t ) {
+ return ( def ); // non-existant
+ }
+
+ int i = atoi ( t );
+
+ return ( i );
+}