summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-11-18 09:19:26 +0100
committerNeal H. Walfield <neal@gnu.org>2008-11-18 09:19:26 +0100
commit468f7efbdbc643ef6ea402e34cec769e4517fc50 (patch)
tree5c90c9a390ebf7c4ea19d4039a16a58c89257d97
parent0308062ac3cf091e50afc739ff2e5e39e7c5faad (diff)
Fix logic error in as_lookup code.
2008-11-17 Neal H. Walfield <neal@gnu.org> * as-lookup.c (DUMP_OR_RET) [NDEBUG]: Just return. (as_lookup_rel_internal) [NDEBUG]: Define dump_path to be false.
-rw-r--r--libhurd-mm/ChangeLog5
-rw-r--r--libhurd-mm/as-lookup.c51
2 files changed, 34 insertions, 22 deletions
diff --git a/libhurd-mm/ChangeLog b/libhurd-mm/ChangeLog
index 070f680..aa8713f 100644
--- a/libhurd-mm/ChangeLog
+++ b/libhurd-mm/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-17 Neal H. Walfield <neal@gnu.org>
+
+ * as-lookup.c (DUMP_OR_RET) [NDEBUG]: Just return.
+ (as_lookup_rel_internal) [NDEBUG]: Define dump_path to be false.
+
2008-11-12 Neal H. Walfield <neal@gnu.org>
* anonymous.h (struct anonymous_pager): Improve documentation for
diff --git a/libhurd-mm/as-lookup.c b/libhurd-mm/as-lookup.c
index ac6a2a9..0a270ab 100644
--- a/libhurd-mm/as-lookup.c
+++ b/libhurd-mm/as-lookup.c
@@ -36,22 +36,23 @@
#ifndef NDEBUG
#define DUMP_OR_RET(ret) \
- { \
- if (dump_path) \
- { \
- debug (0, "Bye."); \
- return ret; \
- } \
- else \
- { \
- dump_path = true; \
- goto dump_path; \
- } \
- }
+ do \
+ { \
+ if (dump_path) \
+ { \
+ debug (0, "Bye."); \
+ return ret; \
+ } \
+ else \
+ { \
+ dump_path = true; \
+ goto dump_path; \
+ } \
+ } \
+ while (0)
#else
#define DUMP_OR_RET(ret) \
- if (dump_path) \
- return ret;
+ return ret;
#endif
static bool
@@ -61,10 +62,14 @@ as_lookup_rel_internal (activity_t activity,
enum as_lookup_mode mode, union as_lookup_ret *rt,
bool dump)
{
- bool dump_path = dump;
-
struct cap *start = root;
- dump_path:;
+
+#ifndef NDEBUG
+ bool dump_path = dump;
+ dump_path:
+#else
+# define dump_path false
+#endif
root = start;
l4_uint64_t addr = addr_prefix (address);
@@ -331,14 +336,16 @@ as_lookup_rel (activity_t activity,
enum cap_type type, bool *writable,
enum as_lookup_mode mode, union as_lookup_ret *rt)
{
+ bool r;
+
#ifdef RM_INTERN
- profile_start ((uintptr_t) &as_lookup_rel, "as_lookup");
+ profile_region (NULL);
#endif
- bool r = as_lookup_rel_internal (activity,
- root, address, type, writable, mode, rt,
- false);
+ r = as_lookup_rel_internal (activity,
+ root, address, type, writable, mode, rt,
+ false);
#ifdef RM_INTERN
- profile_end ((uintptr_t) &as_lookup_rel);
+ profile_region_end ();
#endif
return r;