diff options
author | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2023-11-24 14:46:27 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-11-29 13:16:50 +0100 |
commit | a6e2996dbb47b6f75aca98423c75f1c6bb285109 (patch) | |
tree | 6594037b1cee3fcdcd978aaed27079fa66fb220d | |
parent | bf5849588cb596c7c9da6da27c76a33f1db41d0e (diff) |
l3cfg: factor out _obj_state_data_new() for creating object state
Will be used next.
-rw-r--r-- | src/core/nm-l3cfg.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index 48f4a84a8a..1dc9b766ed 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -1009,6 +1009,21 @@ out: } static void +_obj_states_track_new(NML3Cfg *self, const NMPObject *obj) +{ + char sbuf[NM_UTILS_TO_STRING_BUFFER_SIZE]; + ObjStateData *obj_state; + + obj_state = _obj_state_data_new( + obj, + nm_platform_lookup_obj(self->priv.platform, NMP_CACHE_ID_TYPE_OBJECT_TYPE, obj)); + c_list_link_tail(&self->priv.p->obj_state_lst_head, &obj_state->os_lst); + g_hash_table_add(self->priv.p->obj_state_hash, obj_state); + _LOGD("obj-state: track: %s", _obj_state_data_to_string(obj_state, sbuf, sizeof(sbuf))); + nm_assert_obj_state(self, obj_state); +} + +static void _obj_states_update_all(NML3Cfg *self) { static const NMPObjectType obj_types[] = { @@ -1052,16 +1067,7 @@ _obj_states_update_all(NML3Cfg *self) obj_state = g_hash_table_lookup(self->priv.p->obj_state_hash, &obj); if (!obj_state) { - obj_state = - _obj_state_data_new(obj, - nm_platform_lookup_obj(self->priv.platform, - NMP_CACHE_ID_TYPE_OBJECT_TYPE, - obj)); - c_list_link_tail(&self->priv.p->obj_state_lst_head, &obj_state->os_lst); - g_hash_table_add(self->priv.p->obj_state_hash, obj_state); - _LOGD("obj-state: track: %s", - _obj_state_data_to_string(obj_state, sbuf, sizeof(sbuf))); - nm_assert_obj_state(self, obj_state); + _obj_states_track_new(self, obj); continue; } |