gchar *val;
ucl_object_t *cur;
const gsize num_str_len = 32;
+ ucl_object_iter_t iter = NULL;
target = (GList **)(((gchar *)pd->user_struct) + pd->offset);
return FALSE;
}
- for (cur = obj; cur != NULL; cur = cur->next) {
+ while ((cur = ucl_iterate_object (obj, &iter, true)) != NULL) {
switch (cur->type) {
case UCL_STRING:
- val = memory_pool_strdup (cfg->cfg_pool, ucl_copy_value_trash (obj));
+ val = memory_pool_strdup (cfg->cfg_pool, ucl_copy_value_trash (cur));
break;
case UCL_INT:
val = memory_pool_alloc (cfg->cfg_pool, num_str_len);
p ++;
if (!new->is_master_slave) {
priority = strtoul (p, &err, 10);
- if (err != NULL && (*err == 'm' || *err == 'M' || *err == 's' || *err == 'S')) {
- new->is_master_slave = TRUE;
- }
- else {
- msg_info ("bad character '%c', must be 'm' or 's' or a numeric priority", *err);
+ if (err != NULL && *err != '\0') {
+ if ((*err == 'm' || *err == 'M' || *err == 's' || *err == 'S')) {
+ new->is_master_slave = TRUE;
+ }
+ else {
+ msg_info ("bad character '%x', must be 'm' or 's' or a numeric priority", *err);
+ }
}
}
if (new->is_master_slave) {
priority = 0;
}
serv = &new->servers[new->servers_num];
- if (inet_pton (AF_INET6, p, addr_holder) == 1 ||
- inet_pton (AF_INET, p, addr_holder) == 1) {
+ if (inet_pton (AF_INET6, begin, addr_holder) == 1 ||
+ inet_pton (AF_INET, begin, addr_holder) == 1) {
serv->name = memory_pool_strdup (new->static_pool, begin);
serv->up.priority = priority;
+ serv->up.weight = priority;
new->servers_num ++;
}
else {
- msg_warn ("cannot parse ip address of nameserver: %s", p);
+ msg_warn ("cannot parse ip address of nameserver: %s", begin);
cur = g_list_next (cur);
continue;
}