typedef bool (*conf_item_parser)(const char *str, void *result, char **errmsg);
typedef bool (*conf_item_verifier)(void *value, char **errmsg);
-typedef const char *(*conf_item_formatter)(void *value);
+typedef char *(*conf_item_formatter)(void *value);
struct conf_item {
const char *name;
return value ? "true" : "false";
}
-static const char *
+static char *
format_bool(void *value)
{
bool *b = (bool *)value;
return *value != NULL;
}
-static const char *
+static char *
format_string(void *value)
{
char **str = (char **)value;
return x_strdup(*str);
}
-static const char *
+static char *
format_env_string(void *value)
{
return format_string(value);
}
}
-static const char *
+static char *
format_float(void *value)
{
float *x = (float *)value;
}
}
-static const char *
+static char *
format_size(void *value)
{
uint64_t *size = (uint64_t *)value;
return true;
}
-static const char *
+static char *
format_sloppiness(void *value)
{
unsigned *sloppiness = (unsigned *)value;
}
}
-static const char *
+static char *
format_umask(void *value)
{
unsigned *umask = (unsigned *)value;
}
}
-static const char *
+static char *
format_unsigned(void *value)
{
unsigned *i = (unsigned *)value;
return false;
}
void *value = (char *)conf + item->offset;
- char *str = (char *)item->formatter(value);
+ char *str = item->formatter(value);
fprintf(file, "%s\n", str);
free(str);
return true;
return false;
}
void *value = (char *)conf + item->offset;
- char *str = (char *)item->formatter(value);
+ char *str = item->formatter(value);
char *buf = x_strdup("");
reformat(&buf, "%s = %s", key, str);
printer(buf, conf->item_origins[item->number], context);