goto error;
}
- if (offset != value &&
- VIR_STRNDUP(def->source->data.tcp.host, value, offset - value) < 0)
- goto error;
+ if (offset != value)
+ def->source->data.tcp.host = g_strndup(value, offset - value);
offset2 = strchr(offset, ',');
offset++;
goto error;
}
- if (offset != value &&
- VIR_STRNDUP(def->source->data.udp.connectHost, value, offset - value) < 0)
- goto error;
+ if (offset != value)
+ def->source->data.udp.connectHost = g_strndup(value,
+ offset - value);
offset2 = strchr(offset, '@');
if (offset2 != NULL) {
goto error;
}
- if (offset3 > (offset2 + 1) &&
- VIR_STRNDUP(def->source->data.udp.bindHost,
- offset2 + 1, offset3 - offset2 - 1) < 0)
- goto error;
+ if (offset3 > (offset2 + 1))
+ def->source->data.udp.bindHost = g_strndup(offset2 + 1,
+ offset3 - offset2 - 1);
def->source->data.udp.bindService = g_strdup(offset3 + 1);
} else {
cmd->name);
return -1; /* alias options are tracked by the original name */
}
- if ((p = strchr(name, '=')) &&
- VIR_STRNDUP(name, name, p - name) < 0)
- return -1;
+ if ((p = strchr(name, '=')))
+ name = g_strndup(name, p - name);
for (j = i + 1; cmd->opts[j].name; j++) {
if (STREQ(name, cmd->opts[j].name) &&
cmd->opts[j].type != VSH_OT_ALIAS)