Review at  https://gerrit.osmocom.org/7627

fsm: id: properly set name in case of NULL id

Since alloc relies on osmo_fsm_inst_update_id() to set the name, never skip
that.

In osmo_fsm_inst_alloc(), we allow passing a NULL id, and in
osmo_fsm_inst_update_id(), we set the name without id if id is NULL.

Change-Id: I6d6b09a811b82770818f19b189a57d9fc4a8133b
---
M src/fsm.c
1 file changed, 3 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/27/7627/1

diff --git a/src/fsm.c b/src/fsm.c
index c5256da..0c943d4 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -258,11 +258,9 @@
        fi->log_level = log_level;
        osmo_timer_setup(&fi->timer, fsm_tmr_cb, fi);
 
-       if (id) {
-               if (osmo_fsm_inst_update_id(fi, id) < 0) {
-                               talloc_free(fi);
-                               return NULL;
-               }
+       if (osmo_fsm_inst_update_id(fi, id) < 0) {
+                       talloc_free(fi);
+                       return NULL;
        }
 
        INIT_LLIST_HEAD(&fi->proc.children);

-- 
To view, visit https://gerrit.osmocom.org/7627
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d6b09a811b82770818f19b189a57d9fc4a8133b
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to