chiark
/
gitweb
/
~ian
/
chiark-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2c56327
)
bool cache optional
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 7 Jun 2012 18:14:28 +0000
(19:14 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 7 Jun 2012 18:14:28 +0000
(19:14 +0100)
cprogs/xacpi-simple.c
patch
|
blob
|
history
diff --git
a/cprogs/xacpi-simple.c
b/cprogs/xacpi-simple.c
index 73bea7f508973b40338751e7888ec435db4a095e..eb761a290635ca85ab8f80db11b6d26444c26dca 100644
(file)
--- a/
cprogs/xacpi-simple.c
+++ b/
cprogs/xacpi-simple.c
@@
-531,9
+531,11
@@
static const char *getresource(const char *want) {
}
static int getresource_bool(const char *want, int def, int *cache) {
}
static int getresource_bool(const char *want, int def, int *cache) {
- /* *cache should be initialised to -1 and will be set to !!value */
+ /* *cache should be initialised to -1 and will be set to !!value
+ * alternatively cache==0 is allowed */
+
+ if (cache && *cache >= 0) return *cache;
- if (*cache >= 0) return *cache;
const char *str= getresource(want);
int result = def;
if (str && str[0]) {
const char *str= getresource(want);
int result = def;
if (str && str[0]) {
@@
-549,7
+551,9
@@
static int getresource_bool(const char *want, int def, int *cache) {
}
}
}
}
}
}
- return *cache= result;
+
+ if (cache) *cache= result;
+ return result;
}
static void more_resources(const char *str, const char *why) {
}
static void more_resources(const char *str, const char *why) {