Meem, I've updated the code and webrev so that output_prop_val() is similar to what you suggested. The changes involves the signature of the *2str() function. It takes (void *, const char *, char *). Also, void * arrays don't work too well. So, the vals[] array and its usages isn't as simple as you have it.
http://zhadum.east/export/ws/am223141/checkout-area/nwam1-fixes/webrev/ Thanks, Anurag Peter Memishian wrote: > static void > output_prop_val(const char *prop_name, nwam_value_t value, FILE *wf, > boolean_t quoted_strings) > { > int i; > uint_t num; > nwam_value_type_t value_type; > nwam_error_t ret; > void *vals; > tostr_func_t func; > > if (nwam_value_get_type(value, &value_type) != NWAM_SUCCESS) { > nerr("Get value type error"); > return; > } > > switch (value_type) { > case NWAM_VALUE_TYPE_STRING: > if (nwam_value_get_string_array(value, &vals, &num) != > NWAM_SUCCESS) { > nerr("Get string array error"); > return; > } > func = quoted_strings ? str2qstr : str2str; > break; > case NWAM_VALUE_TYPE_INT64: > if (nwam_value_get_int64_array(value, &vals, &num) != > NWAM_SUCCESS) { > nerr("Get int64 array error"); > return; > } > > func = int2str; > break; > /* ... */ > case NWAM_VALUE_TYPE_BOOLEAN): > if (nwam_value_get_boolean_array(value, &vals, &num) != > NWAM_SUCCESS) { > nerr("Get boolean array error"); > return; > } > > func = bool2str; > break; > } > > for (i = 0; i < num; i++) { > (void) fprintf(wf, "%s%s", func(vals[i]), > i != num-1 ? NWAM_VALUE_DELIMITER_STR : ""); > } > } >