Add some variables in infolist for config options
parent
74d595498d
commit
b009f29021
|
@ -2119,7 +2119,7 @@ config_file_add_to_infolist (struct t_infolist *infolist,
|
|||
struct t_config_option *ptr_option;
|
||||
struct t_infolist_item *ptr_item;
|
||||
int length;
|
||||
char *option_full_name, value[128];
|
||||
char *option_full_name, value[128], *string_values;
|
||||
|
||||
if (!infolist)
|
||||
return 0;
|
||||
|
@ -2180,6 +2180,49 @@ config_file_add_to_infolist (struct t_infolist *infolist,
|
|||
free (option_full_name);
|
||||
return 0;
|
||||
}
|
||||
if (!infolist_new_var_string (ptr_item,
|
||||
"description",
|
||||
(ptr_option->description
|
||||
&& ptr_option->description[0]) ?
|
||||
_(ptr_option->description) : ""))
|
||||
{
|
||||
free (option_full_name);
|
||||
return 0;
|
||||
}
|
||||
if (!infolist_new_var_string (ptr_item,
|
||||
"description_en",
|
||||
ptr_option->description))
|
||||
{
|
||||
free (option_full_name);
|
||||
return 0;
|
||||
}
|
||||
string_values = string_build_with_exploded (ptr_option->string_values,
|
||||
"|");
|
||||
if (!infolist_new_var_string (ptr_item,
|
||||
"string_values",
|
||||
string_values))
|
||||
{
|
||||
if (string_values)
|
||||
free (string_values);
|
||||
free (option_full_name);
|
||||
return 0;
|
||||
}
|
||||
if (string_values)
|
||||
free (string_values);
|
||||
if (!infolist_new_var_integer (ptr_item,
|
||||
"min",
|
||||
ptr_option->min))
|
||||
{
|
||||
free (option_full_name);
|
||||
return 0;
|
||||
}
|
||||
if (!infolist_new_var_integer (ptr_item,
|
||||
"max",
|
||||
ptr_option->max))
|
||||
{
|
||||
free (option_full_name);
|
||||
return 0;
|
||||
}
|
||||
switch (ptr_option->type)
|
||||
{
|
||||
case CONFIG_OPTION_TYPE_BOOLEAN:
|
||||
|
|
|
@ -859,11 +859,11 @@ string_build_with_exploded (char **exploded_string, const char *separator)
|
|||
int i, length, length_separator;
|
||||
char *result;
|
||||
|
||||
if (!exploded_string || !separator)
|
||||
if (!exploded_string)
|
||||
return NULL;
|
||||
|
||||
length = 0;
|
||||
length_separator = strlen (separator);
|
||||
length_separator = (separator) ? strlen (separator) : 0;
|
||||
|
||||
for (i = 0; exploded_string[i]; i++)
|
||||
{
|
||||
|
@ -871,13 +871,16 @@ string_build_with_exploded (char **exploded_string, const char *separator)
|
|||
}
|
||||
|
||||
result = malloc (length + 1);
|
||||
result[0] = '\0';
|
||||
|
||||
for (i = 0; exploded_string[i]; i++)
|
||||
if (result)
|
||||
{
|
||||
strcat (result, exploded_string[i]);
|
||||
if (exploded_string[i + 1])
|
||||
strcat (result, separator);
|
||||
result[0] = '\0';
|
||||
|
||||
for (i = 0; exploded_string[i]; i++)
|
||||
{
|
||||
strcat (result, exploded_string[i]);
|
||||
if (separator && exploded_string[i + 1])
|
||||
strcat (result, separator);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue