This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Avoid strtok for thread safety
Paolo set me straight about the format of the locale string.
{
char const* __save = __s;
size_t __i = 0;
for (; __i < _S_categories_size + _S_extra_categories_size; ++__i)
{
__save = std::find(__save, __s + __len, "=");
char const* __next = std::find(__save, s + __len, ";");
char* __new = new char[__next - __save];
char* __eos = std::copy(__save + 1, __next, __new);
*__eos = '\0';
_M_names[__i] = __new;
if (*__next == '\0')
break;
__save = __next + 1;
}
}
Note that the C++ algorithms have much nicer termination semantics than
most of the C string functions (strcspn excepted).
Nathan Myers
ncm-nospam@cantrip.org