[fix] update feature arrays to use the new APIs
This commit is contained in:
@@ -1,22 +1,25 @@
|
||||
#include "features.h"
|
||||
|
||||
void feature_array_add(char_array *features, int num_args, ...) {
|
||||
if (num_args <= 0) {
|
||||
|
||||
void feature_array_add(cstring_array_t *features, size_t count, ...) {
|
||||
if (count <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, num_args);
|
||||
va_start(args, count);
|
||||
|
||||
for (int i = 0; i < num_args - 1; i++) {
|
||||
cstring_array_start_token(features);
|
||||
|
||||
for (size_t i = 0; i < count - 1; i++) {
|
||||
char *arg = va_arg(args, char *);
|
||||
contiguous_string_array_add_string_unterminated(features, arg);
|
||||
contiguous_string_array_add_string_unterminated(features, FEATURE_SEPARATOR_CHAR);
|
||||
char_array_append(features->str, arg);
|
||||
char_array_append(features->str, FEATURE_SEPARATOR_CHAR);
|
||||
}
|
||||
|
||||
char *arg = va_arg(args, char *);
|
||||
contiguous_string_array_add_string(features, arg);
|
||||
char_array_append(features->str, arg);
|
||||
char_array_terminate(features->str);
|
||||
|
||||
va_end(args);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user