diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | translate.cxx | 9 |
2 files changed, 13 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2006-05-05 David Smith <dsmith@redhat.com> + + * translate.cxx (mapvar::exists): Added code for string array + handling. Otherwise, string array elements always exist. + 2006-05-03 Josh Stone <joshua.i.stone@intel.com> PR 2506 diff --git a/translate.cxx b/translate.cxx index ddbeea0d..30601cf2 100644 --- a/translate.cxx +++ b/translate.cxx @@ -550,7 +550,14 @@ struct mapvar string exists (vector<tmpvar> const & indices) const { - return "((uintptr_t)" + call_prefix("get", indices) + ") != (uintptr_t) 0)"; + if (type() == pe_string) + return ("({ char *v = " + call_prefix("get", indices) + + "); (v != NULL && *v != '\\0');})"); + else if ((type() == pe_long) || (type() == pe_stats)) + return ("((uintptr_t)" + call_prefix("get", indices) + + ") != (uintptr_t) 0)"); + else + throw semantic_error("checking existence of an unsupported map type"); } string get (vector<tmpvar> const & indices, bool pre_agg=false) const |