diff --git a/Jupiter/ArrayList.h b/Jupiter/ArrayList.h index 128bd61..3bfe610 100644 --- a/Jupiter/ArrayList.h +++ b/Jupiter/ArrayList.h @@ -182,8 +182,8 @@ template void Jupiter::ArrayList::empty() template void Jupiter::ArrayList::emptyAndDelete() { - for (size_t i = 0; i < Jupiter::List::length; i++) delete Jupiter::ArrayList::data[i]; - Jupiter::List::length = 0; + while (Jupiter::List::length != 0) + delete Jupiter::ArrayList::data[--Jupiter::List::length]; } template<> struct _Jupiter_DataBuffer_partial_specialization_impl diff --git a/Jupiter/IRC.h b/Jupiter/IRC.h index eb05d50..1b4517b 100644 --- a/Jupiter/IRC.h +++ b/Jupiter/IRC.h @@ -1,5 +1,5 @@ /** - * Copyright (C) 2013-2014 Justin James. + * Copyright (C) 2013-2015 Justin James. * * This license must be preserved. * Any applications, libraries, or code which make any use of any diff --git a/Jupiter/Readable_String_Imp.h b/Jupiter/Readable_String_Imp.h index 8d25fea..9bc34c9 100644 --- a/Jupiter/Readable_String_Imp.h +++ b/Jupiter/Readable_String_Imp.h @@ -1117,27 +1117,48 @@ template template class R> R Jupiter::Readable template template class R> R Jupiter::Readable_String::getWord(const T *in, size_t pos, const T *whitespace) { - unsigned int x = 0; - unsigned int y = 1; - for (unsigned int i = 0; i < pos || y == 1; x++) + if (*in == 0) + return R(); + + while (Jupiter::strpbrk(whitespace, *in) != nullptr) + if (*++in == 0) + return R(); + + if (pos == 0) { - if (in[x] == 0) return R(); - if (Jupiter::strpbrk(whitespace, in[x]) != nullptr) - { - if (y != 1) - { - y = 1; - i++; - } - } - else + do + ++in, ++pos; + while (*in != 0 && Jupiter::strpbrk(whitespace, *in) == nullptr); + + in -= pos; + return R::substring(in, 0, pos); + } + + loop_start: + { + if (Jupiter::strpbrk(whitespace, *in) != nullptr) { - if (i >= pos) break; - y = 0; + do + if (*++in == 0) + return R(); + while (Jupiter::strpbrk(whitespace, *in) != nullptr); + + if (--pos == 0) + goto loop_end; } + + if (++in == 0) + return R(); + goto loop_start; } - for (y = x; in[y] != 0 && Jupiter::strpbrk(whitespace, in[y]) == nullptr; y++); - return R::substring(in, x, y - x); + loop_end: + + do + ++in, ++pos; + while (*in != 0 && Jupiter::strpbrk(whitespace, *in) == nullptr); + + in -= pos; + return R::substring(in, 0, pos); } // getToken diff --git a/Release/Jupiter.lib b/Release/Jupiter.lib index e0a547c..f67f652 100644 Binary files a/Release/Jupiter.lib and b/Release/Jupiter.lib differ