[fix] update feature arrays to use the new APIs
This commit is contained in:
@@ -1,22 +1,25 @@
|
|||||||
#include "features.h"
|
#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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
va_list args;
|
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 *);
|
char *arg = va_arg(args, char *);
|
||||||
contiguous_string_array_add_string_unterminated(features, arg);
|
char_array_append(features->str, arg);
|
||||||
contiguous_string_array_add_string_unterminated(features, FEATURE_SEPARATOR_CHAR);
|
char_array_append(features->str, FEATURE_SEPARATOR_CHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *arg = va_arg(args, 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);
|
va_end(args);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define FEATURE_SEPARATOR_CHAR "|"
|
#define FEATURE_SEPARATOR_CHAR "|"
|
||||||
|
|
||||||
void feature_array_add(char_array *features, int num_args, ...);
|
void feature_array_add(contiguous_string_array_t *features, size_t count, ...);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Reference in New Issue
Block a user