replace BLI_strtok_r from r41337 with lighter method that doesnt alloc for template_list

This commit is contained in:
2011-10-29 08:18:42 +00:00
parent ed77c356fc
commit 1e4be0a4bf
4 changed files with 17 additions and 68 deletions

View File

@@ -375,35 +375,6 @@ int BLI_natstrcmp(const char *s1, const char *s2)
return 0;
}
/* As unfortunately strtok_r is not available everywhere... */
char *BLI_strtok_r(char *str, const char *delimiter, char **ctx)
{
char *cut = NULL, *ret = NULL;
char *split = str ? str : *ctx;
if(!split) {
return ret;
}
cut = strchr(split, *delimiter);
if(cut) {
size_t len_ret = cut - split;
size_t len_ctx = strlen(split) - len_ret - 1;
ret = BLI_strdupn(split, len_ret);
if(len_ctx > 0) {
*ctx = split+len_ret+1;
}
else {
*ctx = NULL;
}
}
else {
ret = BLI_strdup(split);
*ctx = NULL;
}
return ret;
}
void BLI_timestr(double _time, char *str)
{
/* format 00:00:00.00 (hr:min:sec) string has to be 12 long */