diff options
author | Ben Pfaff <blp@ovn.org> | 2017-03-22 14:36:57 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-10-24 16:09:16 -0700 |
commit | d697750af6e81c2a68a3b8b552a5ed98380e7d54 (patch) | |
tree | 6ccf1ad428edd84556fed0dcd8a6b5e91028170e /lib | |
parent | ffa3493a00dfbfeca2959ae4186ed99039a4c112 (diff) | |
download | openvswitch-d697750af6e81c2a68a3b8b552a5ed98380e7d54.tar.gz |
json: New function json_nullable_clone().
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/json.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/json.c b/lib/json.c index 40c8f718d..b98e60f87 100644 --- a/lib/json.c +++ b/lib/json.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2014, 2015 Nicira, Inc. + * Copyright (c) 2009-2012, 2014-2017 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -430,6 +430,12 @@ json_clone(const struct json *json_) return json; } +struct json * +json_nullable_clone(const struct json *json) +{ + return json ? json_clone(json) : NULL; +} + static struct json * json_clone_object(const struct shash *object) { |