Module: sip-router
Branch: master
Commit: 2990e54f50e071101ced7b63c81f89045053f42f
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2990e54…
Author: Ovidiu Sas <osas(a)voipembedded.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: Fri Oct 3 20:20:49 2014 -0400
flags.c: logging: convert LOG to LM_*
---
flags.c | 33 +++++++++++++--------------------
1 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/flags.c b/flags.c
index 4d1f881..883e312 100644
--- a/flags.c
+++ b/flags.c
@@ -70,13 +70,11 @@ int isflagset( struct sip_msg* msg, flag_t flag ) {
int flag_in_range( flag_t flag ) {
if (flag > MAX_FLAG ) {
- LOG(L_ERR, "ERROR: message flag %d too high; MAX=%d\n",
- flag, MAX_FLAG );
+ LM_ERR("message flag %d too high; MAX=%d\n", flag, MAX_FLAG );
return 0;
}
if ((int)flag<0) {
- LOG(L_ERR, "ERROR: message flag (%d) must be in range %d..%d\n",
- flag, 0, MAX_FLAG );
+ LM_ERR("message flag (%d) must be in range 0..%d\n", flag, MAX_FLAG );
return 0;
}
return 1;
@@ -152,8 +150,7 @@ int check_flag(int n)
if (!flag_in_range(n))
return -1;
if (registered_flags[n]){
- LOG(L_WARN, "WARNING: check_flag: flag %d is already used by "
- " a named flag\n", n);
+ LM_WARN("flag %d is already used by a named flag\n", n);
}
return 0;
}
@@ -219,20 +216,18 @@ int register_flag(char* name, int pos)
/* check if the name already exists */
e=flag_search(&name2flags[h], name, len);
if (e){
- LOG(L_ERR, "ERROR: register_flag: flag %.*s already registered\n",
- len, name);
+ LM_ERR("flag %.*s already registered\n", len, name);
return -2;
}
/* check if there is already another flag registered at pos */
if (pos!=-1){
if ((pos<0) || (pos>MAX_FLAG)){
- LOG(L_ERR, "ERROR: register_flag: invalid flag %.*s "
- "position(%d)\n", len, name, pos);
+ LM_ERR("invalid flag %.*s position(%d)\n", len, name, pos);
return -4;
}
if (registered_flags[pos]!=0){
- LOG(L_WARN, "WARNING: register_flag: %.*s: flag %d already in "
- "use under another name\n", len, name, pos);
+ LM_WARN("%.*s: flag %d already in use under another name\n",
+ len, name, pos);
/* continue */
}
}else{
@@ -246,8 +241,7 @@ int register_flag(char* name, int pos)
}
}
if (pos==-1){
- LOG(L_ERR, "ERROR: register_flag: could not register %.*s"
- " - too many flags\n", len, name);
+ LM_ERR("could not register %.*s - too many flags\n", len, name);
return -5;
}
}
@@ -255,7 +249,7 @@ int register_flag(char* name, int pos)
e=pkg_malloc(sizeof(struct flag_entry));
if (e==0){
- LOG(L_ERR, "ERROR: register_flag: memory allocation failure\n");
+ LM_ERR("memory allocation failure\n");
return -3;
}
e->name.s=name;
@@ -279,8 +273,7 @@ static int fixup_t_flag(void** param, int param_no)
DBG("DEBUG: fixing flag: %s\n", (char *) (*param));
if (param_no!=1) {
- LOG(L_ERR, "ERROR: TM module: only parameter #1 for flags can be"
- " fixed\n");
+ LM_ERR("TM module: only parameter #1 for flags can be fixed\n");
return E_BUG;
};
@@ -305,7 +298,7 @@ static int fixup_t_flag(void** param, int param_no)
while ( *c && *c>='0' && *c<='9' ) {
*code = *code*10+ *c-'0';
if (*code > (sizeof( flag_t ) * CHAR_BIT - 1 )) {
- LOG(L_ERR, "ERROR: TM module: too big flag number: %s; MAX=%d\n",
+ LM_ERR("TM module: too big flag number: %s; MAX=%d\n",
(char *) (*param), sizeof( flag_t ) * CHAR_BIT - 1 );
goto error;
}
@@ -315,12 +308,12 @@ static int fixup_t_flag(void** param, int param_no)
while ( *c && (*c==' ' || *c=='\t')) c++; /* terminating
whitespaces */
if ( *code == 0 ) {
- LOG(L_ERR, "ERROR: TM module: bad flag number: %s\n", (char *) (*param));
+ LM_ERR("TM module: bad flag number: %s\n", (char *) (*param));
goto error;
}
if (*code < FL_MAX && token==0) {
- LOG(L_ERR, "ERROR: TM module: too high flag number: %s (%d)\n; lower number"
+ LM_ERR("TM module: too high flag number: %s (%d)\n; lower number"
" bellow %d reserved\n", (char *) (*param), *code, FL_MAX );
goto error;
}