
On 05/03/2013 08:53 AM, Michal Privoznik wrote:
--- src/phyp/phyp_driver.c | 50 ++++++++++---------------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-)
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c @@ -1141,15 +1137,9 @@ phypConnectOpen(virConnectPtr conn,
if (conn->uri->path) { /* need to shift one byte in order to remove the first "/" of URI component */ - if (conn->uri->path[0] == '/') - managed_system = strdup(conn->uri->path + 1); - else - managed_system = strdup(conn->uri->path); - - if (!managed_system) { - virReportOOMError(); + if (VIR_STRDUP(managed_system, conn->uri->path[0] == '/' ? + conn->uri->path + 1 : conn->uri->path) < 0)
Simpler to write: VIR_STRDUP(managed_system, conn->uri->path + (conn->uri->path[0] == '/')) ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org