From 2c17fbc22f84229d5f11c17bbb15696b0dcf9ed6 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Wed, 17 May 2023 16:37:13 +0200 Subject: [PATCH] siprepo: clang-format for coherent indentation and coding style --- src/modules/siprepo/siprepo_data.h | 13 ++++++----- src/modules/siprepo/siprepo_mod.c | 35 +++++++++++++++--------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/modules/siprepo/siprepo_data.h b/src/modules/siprepo/siprepo_data.h index 9301883b02c..616985f5e92 100644 --- a/src/modules/siprepo/siprepo_data.h +++ b/src/modules/siprepo/siprepo_data.h @@ -29,7 +29,8 @@ #define SIPREPO_RMODE_RM 1 -typedef struct siprepo_msg { +typedef struct siprepo_msg +{ unsigned int hid; int mtype; str msgid; @@ -49,7 +50,8 @@ typedef struct siprepo_msg { struct siprepo_msg *prev; } siprepo_msg_t; -typedef struct siprepo_slot { +typedef struct siprepo_slot +{ siprepo_msg_t *plist; gen_lock_t lock; } siprepo_slot_t; @@ -57,10 +59,9 @@ typedef struct siprepo_slot { int siprepo_table_init(void); int siprepo_msg_set(sip_msg_t *msg, str *msgid, int rmode); int siprepo_msg_rm(str *callid, str *msgid); -int siprepo_msg_pull(str *callid, str *msgid, str *rname, - int rmode); -int siprepo_msg_async_pull(str *callid, str *msgid, str *gname, - str *rname, int rmode); +int siprepo_msg_pull(str *callid, str *msgid, str *rname, int rmode); +int siprepo_msg_async_pull( + str *callid, str *msgid, str *gname, str *rname, int rmode); int siprepo_msg_check(sip_msg_t *msg); void siprepo_msg_timer(unsigned int ticks, int worker, void *param); diff --git a/src/modules/siprepo/siprepo_mod.c b/src/modules/siprepo/siprepo_mod.c index 940099622d2..d8f8b02c5ad 100644 --- a/src/modules/siprepo/siprepo_mod.c +++ b/src/modules/siprepo/siprepo_mod.c @@ -49,8 +49,8 @@ static int child_init(int); static void mod_destroy(void); static int w_sr_msg_push(sip_msg_t *msg, char *pmsgid, char *prmode); -static int w_sr_msg_pull(sip_msg_t *msg, char *pcallid, char *pmsgid, char *prname, - char *prmode); +static int w_sr_msg_pull(sip_msg_t *msg, char *pcallid, char *pmsgid, + char *prname, char *prmode); static int w_sr_msg_async_pull(sip_msg_t *msg, char *pcallid, char *pmsgid, char *pgname, char *prname, char *prmode); static int w_sr_msg_rm(sip_msg_t *msg, char *pcallid, char *pmsgid); @@ -108,7 +108,7 @@ struct module_exports exports = { */ static int mod_init(void) { - if(siprepo_table_init()<0) { + if(siprepo_table_init() < 0) { LM_ERR("failed to initialize hash table\n"); return -1; } @@ -124,14 +124,15 @@ static int child_init(int rank) int i; char si_desc[MAX_PT_DESC]; - if(rank!=PROC_MAIN) { + if(rank != PROC_MAIN) { return 0; } - for(i=0; i<_siprepo_timer_procs; i++) { + for(i = 0; i < _siprepo_timer_procs; i++) { snprintf(si_desc, MAX_PT_DESC, "SIPREPO child=%d", i); if(fork_basic_timer_w(PROC_TIMER, si_desc, 1 /*socks flag*/, - siprepo_timer_exec, i, NULL, _siprepo_timer_interval - /*sec*/)<0) { + siprepo_timer_exec, i, NULL, _siprepo_timer_interval + /*sec*/) + < 0) { LM_ERR("failed to start timer routine as process\n"); return -1; /* error */ } @@ -155,7 +156,7 @@ static int ki_sr_msg_push(sip_msg_t *msg, str *msgid, int rmode) ret = siprepo_msg_set(msg, msgid, rmode); - if(ret<0) { + if(ret < 0) { return ret; } return 1; @@ -184,14 +185,14 @@ static int w_sr_msg_push(sip_msg_t *msg, char *pmsgid, char *prmode) /** * */ -static int ki_sr_msg_pull(sip_msg_t *msg, str *callid, str *msgid, str *rname, - int rmode) +static int ki_sr_msg_pull( + sip_msg_t *msg, str *callid, str *msgid, str *rname, int rmode) { int ret; ret = siprepo_msg_pull(callid, msgid, rname, rmode); - if(ret<0) { + if(ret < 0) { return ret; } return 1; @@ -200,8 +201,8 @@ static int ki_sr_msg_pull(sip_msg_t *msg, str *callid, str *msgid, str *rname, /** * */ -static int w_sr_msg_pull(sip_msg_t *msg, char *pcallid, char *pmsgid, char *prname, - char *prmode) +static int w_sr_msg_pull( + sip_msg_t *msg, char *pcallid, char *pmsgid, char *prname, char *prmode) { str callid = STR_NULL; str msgid = STR_NULL; @@ -238,7 +239,7 @@ static int ki_sr_msg_async_pull(sip_msg_t *msg, str *callid, str *msgid, ret = siprepo_msg_async_pull(callid, msgid, gname, rname, rmode); - if(ret<0) { + if(ret < 0) { return ret; } return 1; @@ -290,7 +291,7 @@ static int ki_sr_msg_rm(sip_msg_t *msg, str *callid, str *msgid) ret = siprepo_msg_rm(callid, msgid); - if(ret<0) { + if(ret < 0) { return ret; } return 1; @@ -325,8 +326,8 @@ static int ki_sr_msg_check(sip_msg_t *msg) ret = siprepo_msg_check(msg); - if(ret<=0) { - return (ret-1); + if(ret <= 0) { + return (ret - 1); } return ret; }