Skip to content

Commit

Permalink
sanity: prefix global variables with short name
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Jan 15, 2024
1 parent 7867a29 commit 82ae289
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/modules/sanity/sanity.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ int ki_sanity_reply(sip_msg_t *msg)
|| msg->id != _ksr_sanity_info.msgid
|| msg->pid != _ksr_sanity_info.msgpid) {
LM_INFO("no sanity reply info set - sending 500\n");
if(slb.zreply(msg, 500, "Server Sanity Failure") < 0) {
if(_sanity_slb.zreply(msg, 500, "Server Sanity Failure") < 0) {
return -1;
}
return 1;
}
if(slb.zreply(msg, _ksr_sanity_info.code, _ksr_sanity_info.reason)
if(_sanity_slb.zreply(
msg, _ksr_sanity_info.code, _ksr_sanity_info.reason)
< 0) {
return -1;
}
Expand Down Expand Up @@ -120,7 +121,7 @@ int sanity_reply(sip_msg_t *msg, int code, char *reason)
_ksr_sanity_info.msgpid = msg->pid;
} else {
if(!(msg->msg_flags & FL_MSG_NOREPLY)) {
if(slb.zreply(msg, code, reason) < 0) {
if(_sanity_slb.zreply(msg, code, reason) < 0) {
return -1;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/modules/sanity/sanity_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MODULE_VERSION

#define PROXY_REQUIRE_DEF ""

str pr_str = STR_STATIC_INIT(PROXY_REQUIRE_DEF);
static str _sanity_prval = STR_STATIC_INIT(PROXY_REQUIRE_DEF);

int default_msg_checks = SANITY_DEFAULT_CHECKS;
int default_uri_checks = SANITY_DEFAULT_URI_CHECKS;
Expand All @@ -43,7 +43,7 @@ int ksr_sanity_noreply = 0;

str_list_t *proxyrequire_list = NULL;

sl_api_t slb;
sl_api_t _sanity_slb;

static int mod_init(void);
static int w_sanity_check(sip_msg_t *_msg, char *_msg_check, char *_uri_check);
Expand All @@ -70,7 +70,7 @@ static cmd_export_t cmds[] = {{"sanity_check", (cmd_function)w_sanity_check, 0,
static param_export_t params[] = {
{"default_checks", PARAM_INT, &default_msg_checks},
{"uri_checks", PARAM_INT, &default_uri_checks},
{"proxy_require", PARAM_STR, &pr_str},
{"proxy_require", PARAM_STR, &_sanity_prval},
{"autodrop", PARAM_INT, &_sanity_drop},
{"noreply", PARAM_INT, &ksr_sanity_noreply}, {0, 0, 0}};

Expand Down Expand Up @@ -102,13 +102,13 @@ static int mod_init(void)
ksr_sanity_info_init();

/* bind the SL API */
if(sl_load_api(&slb) != 0) {
if(sl_load_api(&_sanity_slb) != 0) {
LM_ERR("cannot bind to SL API\n");
return -1;
}

LM_DBG("parsing proxy requires string:\n");
ptr = parse_str_list(&pr_str);
ptr = parse_str_list(&_sanity_prval);

proxyrequire_list = ptr;

Expand Down
2 changes: 1 addition & 1 deletion src/modules/sanity/sanity_mod.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
extern int default_checks;
extern str_list_t *proxyrequire_list;

extern sl_api_t slb;
extern sl_api_t _sanity_slb;

#endif /* MOD_SANITY_CHK_H */

0 comments on commit 82ae289

Please sign in to comment.