diff options
author | Thomas Haller <thaller@redhat.com> | 2022-06-24 23:30:31 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-06-30 14:08:40 +0200 |
commit | 902812ce4932e4ba48f6cc0e290de8879fbbafa1 (patch) | |
tree | 177ab08aa492d58b92e7f494eabd0a0a372fa3fe | |
parent | af447c493c67df2e4a81b60d4819fea9cd6c6853 (diff) | |
download | NetworkManager-902812ce4932e4ba48f6cc0e290de8879fbbafa1.tar.gz |
platform: use memset() in _nmp_object_stackinit_from_class()
NMPObject is a union. It's not clear to me that C guarnatees that
designated initializers will meaningfully set all fields to zero. Use
memset() instead.
-rw-r--r-- | src/libnm-platform/nmp-object.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/libnm-platform/nmp-object.c b/src/libnm-platform/nmp-object.c index 6c177b4c26..d02092fc60 100644 --- a/src/libnm-platform/nmp-object.c +++ b/src/libnm-platform/nmp-object.c @@ -805,13 +805,9 @@ _nmp_object_stackinit_from_class(NMPObject *obj, const NMPClass *klass) nm_assert(obj); nm_assert(klass); - *obj = (NMPObject){ - .parent = - { - .klass = (const NMDedupMultiObjClass *) klass, - ._ref_count = NM_OBJ_REF_COUNT_STACKINIT, - }, - }; + memset(obj, 0, sizeof(NMPObject)); + obj->_class = klass; + obj->parent._ref_count = NM_OBJ_REF_COUNT_STACKINIT; return obj; } |