[MERGED] libosmocore[master]: fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Dec 24 17:11:53 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h
......................................................................


fsm: move LOGPFSMSRC and LOGPFSMLSRC to .h

LOGPFSM and LOGPFSML are in the header file, put the *SRC variants also there
so users of the osmo_fsm_inst API may conveniently create own functions that
log the caller's source file and line.

Very useful if many action functions call the same event dispatching function,
like foo_fsm_done(), and one needs to know which of the callers to debug.

Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80
---
M include/osmocom/core/fsm.h
M src/fsm.c
2 files changed, 13 insertions(+), 13 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h
index 57d9a76..8f65533 100644
--- a/include/osmocom/core/fsm.h
+++ b/include/osmocom/core/fsm.h
@@ -125,6 +125,19 @@
 #define LOGPFSM(fi, fmt, args...) \
 		LOGPFSML(fi, (fi)->log_level, fmt, ## args)
 
+#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \
+		LOGPSRC((fi)->fsm->log_subsys, level, \
+			caller_file, caller_line, \
+			"%s{%s}: " fmt, \
+			osmo_fsm_inst_name(fi), \
+			osmo_fsm_state_name((fi)->fsm, (fi)->state), \
+			## args)
+
+#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \
+		LOGPFSMLSRC(fi, (fi)->log_level, \
+			    caller_file, caller_line, \
+			    fmt, ## args)
+
 int osmo_fsm_register(struct osmo_fsm *fsm);
 void osmo_fsm_unregister(struct osmo_fsm *fsm);
 struct osmo_fsm_inst *osmo_fsm_inst_alloc(struct osmo_fsm *fsm, void *ctx, void *priv,
diff --git a/src/fsm.c b/src/fsm.c
index c9902ae..750f016 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -284,19 +284,6 @@
 		return fsm->states[state].name;
 }
 
-#define LOGPFSMLSRC(fi, level, caller_file, caller_line, fmt, args...) \
-		LOGPSRC((fi)->fsm->log_subsys, level, \
-			caller_file, caller_line, \
-			"%s{%s}: " fmt, \
-			osmo_fsm_inst_name(fi), \
-			osmo_fsm_state_name((fi)->fsm, (fi)->state), \
-			## args)
-
-#define LOGPFSMSRC(fi, caller_file, caller_line, fmt, args...) \
-		LOGPFSMLSRC(fi, (fi)->log_level, \
-			    caller_file, caller_line, \
-			    fmt, ## args)
-
 /*! \brief perform a state change of the given FSM instance
  *
  *  Best invoke via the osmo_fsm_inst_state_chg() macro which logs the source

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I39447b1d15237b28f88d8c5f08d82c764679dc80
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list