ref: 65f78869fafdc01c7248d327d47bbe7804862a53
parent: 7a02ce97f0d1373448e8f55e925635390573444c
author: Paul Brossier <piem@piem.org>
date: Fri May 10 05:53:24 EDT 2019
[effects] remove asserts from aubio_split_str
--- a/src/effects/rubberband_utils.c
+++ b/src/effects/rubberband_utils.c
@@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
char_t** aubio_split_str(const char_t* str, const char_t sep) {
char_t** result = 0;
@@ -44,17 +43,18 @@
result = AUBIO_ARRAY(char_t*, count);
if (result) {
- uint_t idx = 0;
+ uint_t idx = 0;
char_t* params = strtok(input, delim);
while (params) {
// make sure we don't got in the wild
- assert(idx < count);
+ if (idx >= count)
+ break;
*(result + idx++) = strdup(params);
params = strtok(0, delim);
}
- assert(idx == count - 1);
- // add null string at the end
- *(result + idx) = 0;
+ // add null string at the end if needed
+ if (idx < count - 1)
+ *(result + idx) = 0;
}
return result;
}