summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-06-10 23:22:12 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-06-12 10:56:04 +0900
commit23422d603ae002a1f368e20cd0f158e057876cb8 (patch)
treef4cfbdfd9c0bd1023da687b9df964a50b1180bc4 /src/gallium
parentf61923441f94439b9ca3c4304ce74fe4e13a14b4 (diff)
gallium: Implement debug_get_num_option.
For numeric options.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/p_debug.c30
-rw-r--r--src/gallium/include/pipe/p_debug.h2
2 files changed, 29 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c
index d1dfc377f8..a0ffb024e4 100644
--- a/src/gallium/auxiliary/util/p_debug.c
+++ b/src/gallium/auxiliary/util/p_debug.c
@@ -230,8 +230,34 @@ debug_get_bool_option(const char *name, boolean dfault)
long
debug_get_num_option(const char *name, long dfault)
{
- /* FIXME */
- return dfault;
+ long result;
+ const char *str;
+
+ str = debug_get_option(name, NULL);
+ if(!str)
+ result = dfault;
+ else {
+ long sign;
+ char c;
+ c = *str++;
+ if(c == '-') {
+ sign = -1;
+ c = *str++;
+ }
+ else {
+ sign = 1;
+ }
+ result = 0;
+ while('0' <= c && c <= '9') {
+ result = result*10 + (c - '0');
+ c = *str++;
+ }
+ result *= sign;
+ }
+
+ debug_printf("%s: %s = %li\n", __FUNCTION__, name, result);
+
+ return result;
}
diff --git a/src/gallium/include/pipe/p_debug.h b/src/gallium/include/pipe/p_debug.h
index 05eca75201..9011557006 100644
--- a/src/gallium/include/pipe/p_debug.h
+++ b/src/gallium/include/pipe/p_debug.h
@@ -289,7 +289,7 @@ boolean
debug_get_bool_option(const char *name, boolean dfault);
long
-debug_get_unsigned_option(const char *name, long dfault);
+debug_get_num_option(const char *name, long dfault);
unsigned long
debug_get_flags_option(const char *name,