aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-30 21:33:15 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-30 21:33:15 -0800
commitaf2d348543f623e30376c54908cfd2eda99fb685 (patch)
tree94ad4f4a02d6a5f20aaaeb06e4321d391ead16c3 /common.cpp
parent13f72decf41ff90319295ee4fae8d3743e317386 (diff)
Substantial modifications of expand_variables to modernize, normalize memory management, adopt C++ types
Diffstat (limited to 'common.cpp')
-rw-r--r--common.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/common.cpp b/common.cpp
index 424e97dd..3c535621 100644
--- a/common.cpp
+++ b/common.cpp
@@ -1820,10 +1820,11 @@ void tokenize_variable_array2( const wcstring &val, std::vector<wcstring> &out)
size_t pos = 0, end = val.size();
while (pos < end) {
size_t next_pos = val.find(ARRAY_SEP, pos);
- if (next_pos == wcstring::npos) next_pos = end;
+ if (next_pos == wcstring::npos) break;
out.push_back(val.substr(pos, next_pos - pos));
pos = next_pos + 1; //skip the separator
}
+ out.push_back(val.substr(pos, end - pos));
}
void tokenize_variable_array( const wchar_t *val, array_list_t *out )