Revision 8996031d src/config.c

View differences:

src/config.c
113 113

  
114 114
  return 1;
115 115
}
116

  
117
const char *config_value_str_default(const struct tag *cfg_values, const char *value, const char *default_value)
118
{
119
  const char *res;
120

  
121
  res = config_value_str(cfg_values, value);
122
  return res ? res : default_value;
123
}
124

  
125
int config_value_int_default(const struct tag *cfg_values, const char *value, int *res, int default_value)
126
{
127
  int r;
128

  
129
  r = config_value_int(cfg_values, value, res);
130
  if (!r) {
131
    *res = default_value;
132
  }
133
  return r;
134
}
135

  
136
int config_value_double_default(const struct tag *cfg_values, const char *value, double *res, double default_value)
137
{
138
  int r;
139

  
140
  r = config_value_double(cfg_values, value, res);
141
  if (!r) {
142
    *res = default_value;
143
  }
144
  return r;
145
}

Also available in: Unified diff