Skip to content

Commit

Permalink
dmq: rename global variables with short name
Browse files Browse the repository at this point in the history
- safety for symbols overlapping
  • Loading branch information
miconda committed Jan 3, 2024
1 parent ae90cb4 commit f0fbf4d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/modules/dmq/dmq.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ static sip_uri_t dmq_notification_uri = {0};
int dmq_ping_interval = 60;

/* TM bind */
struct tm_binds tmb = {0};
struct tm_binds _dmq_tmb = {0};
/* SL API structure */
sl_api_t slb = {0};
sl_api_t _dmq_slb = {0};

/** module variables */
str dmq_request_method = str_init("KDMQ");
Expand Down Expand Up @@ -190,13 +190,13 @@ static int make_socket_str_from_uri(struct sip_uri *uri, str *socket)
static int mod_init(void)
{
/* bind the SL API */
if(sl_load_api(&slb) != 0) {
if(sl_load_api(&_dmq_slb) != 0) {
LM_ERR("cannot bind to SL API\n");
return -1;
}

/* load all TM stuff */
if(load_tm_api(&tmb) == -1) {
if(load_tm_api(&_dmq_tmb) == -1) {
LM_ERR("can't load tm functions. TM module probably not loaded\n");
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/dmq/dmq.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ extern sip_uri_t dmq_server_uri;
extern str_list_t *dmq_notification_address_list;
extern int dmq_multi_notify;
/* sl and tm */
extern struct tm_binds tmb;
extern sl_api_t slb;
extern struct tm_binds _dmq_tmb;
extern sl_api_t _dmq_slb;

extern str dmq_200_rpl;
extern str dmq_400_rpl;
Expand Down
6 changes: 3 additions & 3 deletions src/modules/dmq/dmq_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ int dmq_send_message(dmq_peer_t *peer, str *body, dmq_node_t *node,
TMCB_LOCAL_COMPLETED, dmq_tm_callback, (void *)cb_param);
uac_r.ssock = &dmq_server_socket;

result = tmb.t_request(&uac_r, &to, &to, &from, NULL);
result = _dmq_tmb.t_request(&uac_r, &to, &to, &from, NULL);
if(result < 0) {
LM_ERR("error in tmb.t_request_within\n");
LM_ERR("error in tm t_request_within()\n");
goto error;
}
pkg_free(str_hdr.s);
Expand Down Expand Up @@ -468,7 +468,7 @@ int ki_dmq_t_replicate_mode(struct sip_msg *msg, int mode)
first = 0;
}

if(tmb.t_replicate(msg, &node->orig_uri) < 0) {
if(_dmq_tmb.t_replicate(msg, &node->orig_uri) < 0) {
LM_ERR("error calling t_replicate\n");
goto error;
}
Expand Down
6 changes: 3 additions & 3 deletions src/modules/dmq/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int ki_dmq_handle_message_rc(sip_msg_t *msg, int returnval)
if(!peer) {
LM_DBG("no peer found for %.*s\n", msg->parsed_uri.user.len,
msg->parsed_uri.user.s);
if(slb.freply(msg, 404, &dmq_404_rpl) < 0) {
if(_dmq_slb.freply(msg, 404, &dmq_404_rpl) < 0) {
LM_ERR("sending reply\n");
goto error;
}
Expand Down Expand Up @@ -158,7 +158,7 @@ int ki_dmq_process_message_rc(sip_msg_t *msg, int returnval)
if(!peer) {
LM_DBG("no peer found for %.*s\n", msg->parsed_uri.user.len,
msg->parsed_uri.user.s);
if(slb.freply(msg, 404, &dmq_404_rpl) < 0) {
if(_dmq_slb.freply(msg, 404, &dmq_404_rpl) < 0) {
LM_ERR("sending reply\n");
goto error;
}
Expand Down Expand Up @@ -190,7 +190,7 @@ int ki_dmq_process_message_rc(sip_msg_t *msg, int returnval)
/* send the reply */
if(peer_response.resp_code > 0 && peer_response.reason.s != NULL
&& peer_response.reason.len > 0) {
if(slb.freply(msg, peer_response.resp_code, &peer_response.reason)
if(_dmq_slb.freply(msg, peer_response.resp_code, &peer_response.reason)
< 0) {
LM_ERR("error sending reply\n");
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/dmq/worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ void worker_loop(int id)
/* send the reply */
if(peer_response.resp_code > 0 && peer_response.reason.s != NULL
&& peer_response.reason.len > 0) {
if(slb.freply(current_job->msg, peer_response.resp_code,
&peer_response.reason)
if(_dmq_slb.freply(current_job->msg,
peer_response.resp_code, &peer_response.reason)
< 0) {
LM_ERR("error sending reply\n");
} else {
Expand Down

0 comments on commit f0fbf4d

Please sign in to comment.