Browse Source

tm: small helper functions to get/set current T and branch

- pair for coherent naming
Daniel-Constantin Mierla 10 months ago
parent
commit
027ca1b2e1
2 changed files with 14 additions and 0 deletions
  1. 12 0
      src/modules/tm/t_lookup.c
  2. 2 0
      src/modules/tm/t_lookup.h

+ 12 - 0
src/modules/tm/t_lookup.c

@@ -150,6 +150,18 @@ int get_t_branch()
 	return T_branch;
 }
 
+void tm_get_tb(struct cell **t, int *branch)
+{
+	*t = T;
+	*branch = T_branch;
+}
+
+void tm_set_tb(struct cell *t, int branch)
+{
+	T = t;
+	T_branch = branch;
+}
+
 /**
  * return the transaction by combining get() and t_check_msg()
  * - if T is not set, checks the transactions table for msg, and if found,

+ 2 - 0
src/modules/tm/t_lookup.h

@@ -79,6 +79,8 @@ int get_t_branch(void);
 typedef void (*tsett_f)(struct cell *t, int branch);
 void set_t(struct cell *t, int branch);
 
+void tm_get_tb(struct cell **t, int *branch);
+void tm_set_tb(struct cell *t, int branch);
 
 #define T_GET_TI "t_get_trans_ident"
 #define T_LOOKUP_IDENT "t_lookup_ident"