diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-27 15:52:56 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-27 15:52:56 +0000 |
commit | db07a1f968269c3d2076b403ebb808b2fdcc8258 (patch) | |
tree | 74b2e6933215849b3a07e112fb2b9f893431888f /main | |
parent | 38c229a3bc4261be3dc317549134490f2059b9d6 (diff) |
Merged revisions 144924-144925 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r144924 | kpfleming | 2008-09-27 10:00:48 -0500 (Sat, 27 Sep 2008) | 6 lines
improve header inclusion process in a few small ways:
- it is no longer necessary to forcibly include asterisk/autoconfig.h; every module already includes asterisk.h as its first header (even before system headers), which serves the same purpose
- astmm.h is now included by asterisk.h when needed, instead of being forced by the Makefile; this means external modules will build properly against installed headers with MALLOC_DEBUG enabled
- simplify the usage of some of these headers in the AEL-related stuff in the utils directory
........
r144925 | kpfleming | 2008-09-27 10:13:30 -0500 (Sat, 27 Sep 2008) | 2 lines
fix some minor issues with rev 144924
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@144949 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/Makefile | 9 | ||||
-rw-r--r-- | main/ast_expr2.c | 66 | ||||
-rw-r--r-- | main/ast_expr2.fl | 6 | ||||
-rw-r--r-- | main/ast_expr2.y | 66 | ||||
-rw-r--r-- | main/ast_expr2f.c | 8 | ||||
-rw-r--r-- | main/astmm.c | 4 | ||||
-rw-r--r-- | main/stdtime/localtime.c | 1 |
7 files changed, 28 insertions, 132 deletions
diff --git a/main/Makefile b/main/Makefile index db4aad7e4..b1ef7ef77 100644 --- a/main/Makefile +++ b/main/Makefile @@ -123,9 +123,12 @@ ast_expr2.c ast_expr2.h: bison -o $@ -d --name-prefix=ast_yy ast_expr2.y ast_expr2f.c: - flex -o $@ --full ast_expr2.fl # moved the correction of yyfree into the flex input file itself. - sed 's@#if __STDC_VERSION__ >= 199901L@#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L@' ast_expr2f.c > zz - mv zz ast_expr2f.c + flex -o $@ --full ast_expr2.fl + sed 's@#if __STDC_VERSION__ >= 199901L@#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L@' $@ > $@.fix + echo "#include \"asterisk.h\"" > $@ + echo >> $@ + cat $@.fix >> $@ + rm $@.fix ast_expr2f.o: ASTCFLAGS+=-Wno-unused diff --git a/main/ast_expr2.c b/main/ast_expr2.c index 9d6bf6e72..37f4108bd 100644 --- a/main/ast_expr2.c +++ b/main/ast_expr2.c @@ -143,11 +143,14 @@ * $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $ */ +#include "asterisk.h" + #include <sys/types.h> #include <stdio.h> -#include "asterisk.h" + +#if !defined(STANDALONE) ASTERISK_FILE_VERSION(__FILE__, "$Revision$") -#ifdef STANDALONE +#else #ifndef __USE_ISOC99 #define __USE_ISOC99 1 #endif @@ -436,7 +439,6 @@ static int to_number __P((struct val *)); static void to_string __P((struct val *)); static struct expr_node *alloc_expr_node(enum node_type); static void destroy_arglist(struct expr_node *arglist); -static int is_really_num(char *str); /* uh, if I want to predeclare yylex with a YYLTYPE, I have to predeclare the yyltype... sigh */ typedef struct yyltype @@ -2502,61 +2504,6 @@ is_zero_or_null (struct val *vp) /* NOTREACHED */ } -#ifdef STANDALONE - -void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) -{ - va_list vars; - va_start(vars,fmt); - - printf("LOG: lev:%d file:%s line:%d func: %s ", - level, file, line, function); - vprintf(fmt, vars); - fflush(stdout); - va_end(vars); -} - - -int main(int argc,char **argv) { - char s[4096]; - char out[4096]; - FILE *infile; - - if( !argv[1] ) - exit(20); - - if( access(argv[1],F_OK)== 0 ) - { - int ret; - - infile = fopen(argv[1],"r"); - if( !infile ) - { - printf("Sorry, couldn't open %s for reading!\n", argv[1]); - exit(10); - } - while( fgets(s,sizeof(s),infile) ) - { - if( s[strlen(s)-1] == '\n' ) - s[strlen(s)-1] = 0; - - ret = ast_expr(s, out, sizeof(out),NULL); - printf("Expression: %s Result: [%d] '%s'\n", - s, ret, out); - } - fclose(infile); - } - else - { - if (ast_expr(argv[1], s, sizeof(s), NULL)) - printf("=====%s======\n",s); - else - printf("No result\n"); - } -} - -#endif - #undef ast_yyerror #define ast_yyerror(x) ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio) @@ -2581,6 +2528,7 @@ static void destroy_arglist(struct expr_node *arglist) } } +#if !defined(STANDALONE) static char *compose_func_args(struct expr_node *arglist) { struct expr_node *t = arglist; @@ -2630,7 +2578,7 @@ static int is_really_num(char *str) else return 0; } - +#endif static struct val *op_func(struct val *funcname, struct expr_node *arglist, struct ast_channel *chan) { diff --git a/main/ast_expr2.fl b/main/ast_expr2.fl index f446606f0..6fca88293 100644 --- a/main/ast_expr2.fl +++ b/main/ast_expr2.fl @@ -22,12 +22,10 @@ * \brief Dialplan Expression Lexical Scanner */ -#include "asterisk.h" - #include <sys/types.h> #include <stdio.h> -#ifndef STANDALONE +#if !defined(STANDALONE) ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #else #ifndef __USE_ISOC99 @@ -276,7 +274,7 @@ int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan) return_value = (res_length <= length) ? res_length : length; } else { if (io.val->u.s) -#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL) +#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE) strncpy(buf, io.val->u.s, length - 1); #else /* !STANDALONE && !LOW_MEMORY */ ast_copy_string(buf, io.val->u.s, length); diff --git a/main/ast_expr2.y b/main/ast_expr2.y index 76fe16005..a179feaeb 100644 --- a/main/ast_expr2.y +++ b/main/ast_expr2.y @@ -12,11 +12,14 @@ * $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $ */ +#include "asterisk.h" + #include <sys/types.h> #include <stdio.h> -#include "asterisk.h" + +#if !defined(STANDALONE) ASTERISK_FILE_VERSION(__FILE__, "$Revision$") -#ifdef STANDALONE +#else #ifndef __USE_ISOC99 #define __USE_ISOC99 1 #endif @@ -305,7 +308,6 @@ static int to_number __P((struct val *)); static void to_string __P((struct val *)); static struct expr_node *alloc_expr_node(enum node_type); static void destroy_arglist(struct expr_node *arglist); -static int is_really_num(char *str); /* uh, if I want to predeclare yylex with a YYLTYPE, I have to predeclare the yyltype... sigh */ typedef struct yyltype @@ -648,61 +650,6 @@ is_zero_or_null (struct val *vp) /* NOTREACHED */ } -#ifdef STANDALONE - -void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) -{ - va_list vars; - va_start(vars,fmt); - - printf("LOG: lev:%d file:%s line:%d func: %s ", - level, file, line, function); - vprintf(fmt, vars); - fflush(stdout); - va_end(vars); -} - - -int main(int argc,char **argv) { - char s[4096]; - char out[4096]; - FILE *infile; - - if( !argv[1] ) - exit(20); - - if( access(argv[1],F_OK)== 0 ) - { - int ret; - - infile = fopen(argv[1],"r"); - if( !infile ) - { - printf("Sorry, couldn't open %s for reading!\n", argv[1]); - exit(10); - } - while( fgets(s,sizeof(s),infile) ) - { - if( s[strlen(s)-1] == '\n' ) - s[strlen(s)-1] = 0; - - ret = ast_expr(s, out, sizeof(out),NULL); - printf("Expression: %s Result: [%d] '%s'\n", - s, ret, out); - } - fclose(infile); - } - else - { - if (ast_expr(argv[1], s, sizeof(s), NULL)) - printf("=====%s======\n",s); - else - printf("No result\n"); - } -} - -#endif - #undef ast_yyerror #define ast_yyerror(x) ast_yyerror(x, YYLTYPE *yylloc, struct parse_io *parseio) @@ -727,6 +674,7 @@ static void destroy_arglist(struct expr_node *arglist) } } +#if !defined(STANDALONE) static char *compose_func_args(struct expr_node *arglist) { struct expr_node *t = arglist; @@ -776,7 +724,7 @@ static int is_really_num(char *str) else return 0; } - +#endif static struct val *op_func(struct val *funcname, struct expr_node *arglist, struct ast_channel *chan) { diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c index 2ba568d82..b6ab64e26 100644 --- a/main/ast_expr2f.c +++ b/main/ast_expr2f.c @@ -1,3 +1,5 @@ +#include "asterisk.h" + #line 2 "ast_expr2f.c" #line 4 "ast_expr2f.c" @@ -2316,12 +2318,10 @@ static yyconst yy_state_type yy_NUL_trans[60] = * \brief Dialplan Expression Lexical Scanner */ -#include "asterisk.h" - #include <sys/types.h> #include <stdio.h> -#ifndef STANDALONE +#if !defined(STANDALONE) ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #else #ifndef __USE_ISOC99 @@ -4133,7 +4133,7 @@ int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan) return_value = (res_length <= length) ? res_length : length; } else { if (io.val->u.s) -#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL) +#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE) strncpy(buf, io.val->u.s, length - 1); #else /* !STANDALONE && !LOW_MEMORY */ ast_copy_string(buf, io.val->u.s, length); diff --git a/main/astmm.c b/main/astmm.c index 60543ecbc..4659d5be2 100644 --- a/main/astmm.c +++ b/main/astmm.c @@ -23,10 +23,10 @@ * \author Mark Spencer <markster@digium.com> */ -#ifdef __AST_DEBUG_MALLOC - #include "asterisk.h" +#ifdef __AST_DEBUG_MALLOC + ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/paths.h" /* use ast_config_AST_LOG_DIR */ diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c index 445f93a55..b25b8ab14 100644 --- a/main/stdtime/localtime.c +++ b/main/stdtime/localtime.c @@ -44,7 +44,6 @@ /*LINTLIBRARY*/ - #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") |