mirror of https://github.com/sipwise/kamailio.git
Change-Id: I8c229738963663e766395f44697a2531dc03ce14changes/81/36681/3
parent
79520e8569
commit
6b1b0af62c
@ -0,0 +1,34 @@
|
||||
From 83a437144bad5d31f5ce1bfc10b03f613524852f Mon Sep 17 00:00:00 2001
|
||||
From: lazedo <luis.azedo@factorlusitano.com>
|
||||
Date: Fri, 18 Jan 2019 13:18:01 +0000
|
||||
Subject: [PATCH] core: allow pp_define_get to be used by modules
|
||||
|
||||
---
|
||||
src/core/cfg.lex | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/cfg.lex b/src/core/cfg.lex
|
||||
index 6e4d6971e..9912d111b 100644
|
||||
--- a/src/core/cfg.lex
|
||||
+++ b/src/core/cfg.lex
|
||||
@@ -113,7 +113,7 @@
|
||||
struct sr_yy_fname *next;
|
||||
} *sr_yy_fname_list = 0;
|
||||
|
||||
- static str *pp_define_get(int len, const char * text);
|
||||
+ str *pp_define_get(int len, const char * text);
|
||||
static int pp_ifdef_type(int pos);
|
||||
static void pp_ifdef_var(int len, const char * text);
|
||||
static void pp_ifdef();
|
||||
@@ -1856,7 +1856,7 @@ int pp_define_set(int len, char *text)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static str *pp_define_get(int len, const char * text)
|
||||
+str *pp_define_get(int len, const char * text)
|
||||
{
|
||||
str var = {(char *)text, len};
|
||||
int i;
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
From b5f27fe25247e3605aeeb600de5a6b31081d6ac6 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel-Constantin Mierla <miconda@gmail.com>
|
||||
Date: Thu, 24 Jan 2019 15:53:55 +0100
|
||||
Subject: [PATCH] core: export pp_define_get() via ppcfg.h
|
||||
|
||||
---
|
||||
src/core/ppcfg.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/core/ppcfg.h b/src/core/ppcfg.h
|
||||
index 432d76bcf..848505991 100644
|
||||
--- a/src/core/ppcfg.h
|
||||
+++ b/src/core/ppcfg.h
|
||||
@@ -41,6 +41,7 @@ int pp_subst_run(char **data);
|
||||
int pp_define(int len, const char *text);
|
||||
int pp_define_set(int len, char *text);
|
||||
int pp_define_set_type(int type);
|
||||
+str *pp_define_get(int len, const char * text);
|
||||
|
||||
void pp_ifdef_level_update(int val);
|
||||
void pp_ifdef_level_check(void);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
From ed10d7692b99b1cd6d3975c06d8b0d9d3270779d Mon Sep 17 00:00:00 2001
|
||||
From: Henning Westerholt <hw@skalatan.de>
|
||||
Date: Fri, 6 Sep 2019 11:37:44 +0200
|
||||
Subject: [PATCH] core: improve error message related to a mismatch of
|
||||
#!ifdef/#!define statement
|
||||
|
||||
---
|
||||
src/core/ppcfg.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/ppcfg.c b/src/core/ppcfg.c
|
||||
index 3b026f997..49065938a 100644
|
||||
--- a/src/core/ppcfg.c
|
||||
+++ b/src/core/ppcfg.c
|
||||
@@ -219,8 +219,13 @@ void pp_ifdef_level_update(int val)
|
||||
void pp_ifdef_level_check(void)
|
||||
{
|
||||
if(_pp_ifdef_level!=0) {
|
||||
- LM_WARN("different number of preprocessor directives:"
|
||||
- " N(#!IF[N]DEF) - N(#!ENDIF) = %d\n", _pp_ifdef_level);
|
||||
+ if (_pp_ifdef_level > 0) {
|
||||
+ LM_WARN("different number of preprocessor directives:"
|
||||
+ " %d more #!if[n]def as #!endif\n", _pp_ifdef_level);
|
||||
+ } else {
|
||||
+ LM_WARN("different number of preprocessor directives:"
|
||||
+ " %d more #!endif as #!if[n]def\n", (_pp_ifdef_level)*-1);
|
||||
+ }
|
||||
} else {
|
||||
LM_DBG("same number of pairing preprocessor directives"
|
||||
" #!IF[N]DEF - #!ENDIF\n");
|
||||
--
|
||||
2.20.1
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
From 992dcdabbb42394ad694354cf283a3beb7b66878 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Seva <linuxmaniac@torreviejawireless.org>
|
||||
Date: Mon, 23 Dec 2019 13:53:39 +0100
|
||||
Subject: [PATCH] core: stop start if ifdef check fails
|
||||
|
||||
Related #2057
|
||||
---
|
||||
src/core/ppcfg.c | 20 ++++++++++++++------
|
||||
src/core/ppcfg.h | 3 ++-
|
||||
src/main.c | 5 ++---
|
||||
3 files changed, 18 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/core/ppcfg.c b/src/core/ppcfg.c
|
||||
index 584a491ba..115707aa0 100644
|
||||
--- a/src/core/ppcfg.c
|
||||
+++ b/src/core/ppcfg.c
|
||||
@@ -216,19 +216,27 @@ void pp_ifdef_level_update(int val)
|
||||
/**
|
||||
*
|
||||
*/
|
||||
-void pp_ifdef_level_check(void)
|
||||
+int pp_ifdef_level_check(void)
|
||||
+{
|
||||
+ if(_pp_ifdef_level!=0) {
|
||||
+ return -1;
|
||||
+ } else {
|
||||
+ LM_DBG("same number of pairing preprocessor directives"
|
||||
+ " #!IF[N]DEF - #!ENDIF\n");
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void pp_ifdef_level_error(void)
|
||||
{
|
||||
if(_pp_ifdef_level!=0) {
|
||||
if (_pp_ifdef_level > 0) {
|
||||
- LM_WARN("different number of preprocessor directives:"
|
||||
+ LM_ERR("different number of preprocessor directives:"
|
||||
" %d more #!if[n]def as #!endif\n", _pp_ifdef_level);
|
||||
} else {
|
||||
- LM_WARN("different number of preprocessor directives:"
|
||||
+ LM_ERR("different number of preprocessor directives:"
|
||||
" %d more #!endif as #!if[n]def\n", (_pp_ifdef_level)*-1);
|
||||
}
|
||||
- } else {
|
||||
- LM_DBG("same number of pairing preprocessor directives"
|
||||
- " #!IF[N]DEF - #!ENDIF\n");
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/core/ppcfg.h b/src/core/ppcfg.h
|
||||
index 848505991..6fbd8a352 100644
|
||||
--- a/src/core/ppcfg.h
|
||||
+++ b/src/core/ppcfg.h
|
||||
@@ -44,7 +44,8 @@ int pp_define_set_type(int type);
|
||||
str *pp_define_get(int len, const char * text);
|
||||
|
||||
void pp_ifdef_level_update(int val);
|
||||
-void pp_ifdef_level_check(void);
|
||||
+int pp_ifdef_level_check(void);
|
||||
+void pp_ifdef_level_error(void);
|
||||
|
||||
void pp_define_core(void);
|
||||
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 0bc2e650d..1c62c6d13 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -2299,10 +2299,10 @@ try_again:
|
||||
|
||||
yyin=cfg_stream;
|
||||
debug_save = default_core_cfg.debug;
|
||||
- if ((yyparse()!=0)||(cfg_errors)){
|
||||
+ if ((yyparse()!=0)||(cfg_errors)||(pp_ifdef_level_check()<0)){
|
||||
fprintf(stderr, "ERROR: bad config file (%d errors)\n", cfg_errors);
|
||||
if (debug_flag) default_core_cfg.debug = debug_save;
|
||||
- pp_ifdef_level_check();
|
||||
+ pp_ifdef_level_error();
|
||||
|
||||
goto error;
|
||||
}
|
||||
@@ -2310,7 +2310,6 @@ try_again:
|
||||
fprintf(stderr, "%d config warnings\n", cfg_warnings);
|
||||
}
|
||||
if (debug_flag) default_core_cfg.debug = debug_save;
|
||||
- pp_ifdef_level_check();
|
||||
print_rls();
|
||||
|
||||
if(init_dst_set()<0) {
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Loading…
Reference in new issue