summaryrefslogtreecommitdiff
path: root/ovn
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-06-24 21:23:16 -0700
committerBen Pfaff <blp@ovn.org>2016-06-26 20:31:28 -0700
commit2225c0b9355e6823a2adccfeef2fb3fe3cccb557 (patch)
tree03d24cfb8f4d38cc82dc08f728e4a0d4dae809d6 /ovn
parent05e81316ca53077b97ecf56c32b24b99efe3e51e (diff)
downloadopenvswitch-2225c0b9355e6823a2adccfeef2fb3fe3cccb557.tar.gz
util: New function nullable_xstrdup().
It's a pretty common pattern so create a function for it. Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn')
-rw-r--r--ovn/utilities/ovn-nbctl.c2
-rw-r--r--ovn/utilities/ovn-sbctl.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 7789cddd0..345647ac2 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -235,7 +235,7 @@ parse_options(int argc, char *argv[], struct shash *local_options)
}
shash_add_nocopy(local_options,
xasprintf("--%s", options[idx].name),
- optarg ? xstrdup(optarg) : NULL);
+ nullable_xstrdup(optarg));
break;
case 'h':
diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index c0ee51846..a12b24757 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -249,7 +249,7 @@ parse_options(int argc, char *argv[], struct shash *local_options)
}
shash_add_nocopy(local_options,
xasprintf("--%s", options[idx].name),
- optarg ? xstrdup(optarg) : NULL);
+ nullable_xstrdup(optarg));
break;
case 'h':