|
@@ -52,10 +52,11 @@
|
|
|
|
|
|
static int
|
|
|
string_parse(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
(void)params;
|
|
|
(void)errmsg;
|
|
|
+ (void)key;
|
|
|
char **p = (char**)target;
|
|
|
*p = tor_strdup(value);
|
|
|
return 0;
|
|
@@ -106,8 +107,10 @@ static const int_parse_params_t INT_PARSE_POSINT = {
|
|
|
};
|
|
|
|
|
|
static int
|
|
|
-int_parse(void *target, const char *value, char **errmsg, const void *params)
|
|
|
+int_parse(void *target, const char *value, char **errmsg, const void *params,
|
|
|
+ const char *key)
|
|
|
{
|
|
|
+ (void)key;
|
|
|
const int_parse_params_t *pp;
|
|
|
if (params) {
|
|
|
pp = params;
|
|
@@ -169,10 +172,11 @@ static const var_type_fns_t int_fns = {
|
|
|
|
|
|
static int
|
|
|
uint64_parse(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
(void)params;
|
|
|
(void)errmsg;
|
|
|
+ (void)key;
|
|
|
uint64_t *p = target;
|
|
|
int ok=0;
|
|
|
*p = tor_parse_uint64(value, 10, 0, UINT64_MAX, &ok, NULL);
|
|
@@ -219,8 +223,9 @@ static const var_type_fns_t uint64_fns = {
|
|
|
|
|
|
static int
|
|
|
units_parse_u64(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
+ (void)key;
|
|
|
const unit_table_t *table = params;
|
|
|
tor_assert(table);
|
|
|
uint64_t *v = (uint64_t*)target;
|
|
@@ -235,8 +240,9 @@ units_parse_u64(void *target, const char *value, char **errmsg,
|
|
|
|
|
|
static int
|
|
|
units_parse_int(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
+ (void)key;
|
|
|
const unit_table_t *table = params;
|
|
|
tor_assert(table);
|
|
|
int *v = (int*)target;
|
|
@@ -283,10 +289,11 @@ static const var_type_fns_t interval_fns = {
|
|
|
|
|
|
static int
|
|
|
double_parse(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
(void)params;
|
|
|
(void)errmsg;
|
|
|
+ (void)key;
|
|
|
double *v = (double*)target;
|
|
|
char *endptr=NULL;
|
|
|
errno = 0;
|
|
@@ -347,8 +354,9 @@ typedef struct enumeration_table_t {
|
|
|
|
|
|
static int
|
|
|
enum_parse(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
+ (void)key;
|
|
|
const enumeration_table_t *table = params;
|
|
|
int *p = (int *)target;
|
|
|
for (; table->name; ++table) {
|
|
@@ -422,9 +430,10 @@ static const var_type_fns_t enum_fns = {
|
|
|
|
|
|
static int
|
|
|
time_parse(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
(void) params;
|
|
|
+ (void) key;
|
|
|
time_t *p = target;
|
|
|
if (parse_iso_time(value, p) < 0) {
|
|
|
tor_asprintf(errmsg, "Invalid time %s", escaped(value));
|
|
@@ -466,10 +475,11 @@ static const var_type_fns_t time_fns = {
|
|
|
|
|
|
static int
|
|
|
csv_parse(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
(void)params;
|
|
|
(void)errmsg;
|
|
|
+ (void)key;
|
|
|
smartlist_t **sl = (smartlist_t**)target;
|
|
|
*sl = smartlist_new();
|
|
|
smartlist_split_string(*sl, value, ",",
|
|
@@ -515,7 +525,7 @@ static const var_type_fns_t csv_fns = {
|
|
|
|
|
|
static int
|
|
|
legacy_csv_interval_parse(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
(void)params;
|
|
|
|
|
@@ -529,7 +539,7 @@ legacy_csv_interval_parse(void *target, const char *value, char **errmsg,
|
|
|
val = tmp;
|
|
|
}
|
|
|
|
|
|
- int rv = units_parse_int(target, val, errmsg, &time_units);
|
|
|
+ int rv = units_parse_int(target, val, errmsg, &time_units, key);
|
|
|
tor_free(tmp);
|
|
|
return rv;
|
|
|
}
|
|
@@ -693,14 +703,17 @@ static const var_type_fns_t linelist_s_fns = {
|
|
|
|
|
|
static int
|
|
|
ignore_parse(void *target, const char *value, char **errmsg,
|
|
|
- const void *params)
|
|
|
+ const void *params, const char *key)
|
|
|
{
|
|
|
(void)target;
|
|
|
(void)value;
|
|
|
(void)errmsg;
|
|
|
(void)params;
|
|
|
|
|
|
- log_warn(LD_GENERAL, "Skipping obsolete configuration option.");
|
|
|
+ log_warn(LD_GENERAL, "Skipping obsolete configuration option%s%s%s",
|
|
|
+ key && *key ? " \"" : "",
|
|
|
+ key && *key ? key : "",
|
|
|
+ key && *key ? "\"." : ".");
|
|
|
return 0;
|
|
|
}
|
|
|
|