mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 22:35:15 +00:00
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>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
|
||||
/* Copyright (c) 2009, 2010, 2011, 2012, 2016 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -183,8 +183,8 @@ ovsdb_error_clone(const struct ovsdb_error *old)
|
||||
if (old) {
|
||||
struct ovsdb_error *new = xmalloc(sizeof *new);
|
||||
new->tag = old->tag;
|
||||
new->details = old->details ? xstrdup(old->details) : NULL;
|
||||
new->syntax = old->syntax ? xstrdup(old->syntax) : NULL;
|
||||
new->details = nullable_xstrdup(old->details);
|
||||
new->syntax = nullable_xstrdup(old->syntax);
|
||||
new->errno_ = old->errno_;
|
||||
return new;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user