Simplified Function Substr

This commit is contained in:
Adrian Scillato 2018-09-06 14:21:52 -03:00 committed by GitHub
parent 2fdc91f1b4
commit 420be8f499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -143,7 +143,7 @@ char* subStr(char* dest, char* str, const char *delim, int index)
int i;
// Since strtok consumes the first arg, make a copy
strncpy(dest, str, strlen(str));
strncpy(dest, str, strlen(str)+1);
for (i = 1, act = dest; i <= index; i++, act = NULL) {
sub = strtok_r(act, delim, &ptr);
if (sub == NULL) break;