diff options
Diffstat (limited to 'src/report.cc')
-rw-r--r-- | src/report.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/report.cc b/src/report.cc index 2f3cc302..cb7f09dc 100644 --- a/src/report.cc +++ b/src/report.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2017, John Wiegley. All rights reserved. + * Copyright (c) 2003-2018, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -633,18 +633,15 @@ value_t report_t::fn_trim(call_scope_t& args) std::strcpy(buf.get(), temp.c_str()); const char * p = buf.get(); - while (*p && std::isspace(*p)) + const char * e = buf.get() + temp.length() - 1; + + while (p <= e && std::isspace(*p)) p++; - const char * e = buf.get() + temp.length() - 1; while (e > p && std::isspace(*e)) e--; - if (e == p) { - return string_value(empty_string); - } - else if (e < p) { - assert(false); + if (p > e) { return string_value(empty_string); } else { |