[svn-commits] murf: branch murf/bug_7638 r59184 - in /team/murf/bug_7638: main/ utils/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Mar 22 18:15:01 MST 2007


Author: murf
Date: Thu Mar 22 20:15:00 2007
New Revision: 59184

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59184
Log:
7605 is complete. It lives in aelparse; I can't provide it in asterisk or the AEL mod, because at load time, the extensions.conf may not have been loaded yet.

Modified:
    team/murf/bug_7638/main/pval.c
    team/murf/bug_7638/utils/Makefile
    team/murf/bug_7638/utils/check_expr.c
    team/murf/bug_7638/utils/extconf.c

Modified: team/murf/bug_7638/main/pval.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/main/pval.c?view=diff&rev=59184&r1=59183&r2=59184
==============================================================================
--- team/murf/bug_7638/main/pval.c (original)
+++ team/murf/bug_7638/main/pval.c Thu Mar 22 20:15:00 2007
@@ -1334,8 +1334,8 @@
 					}
 				} else {
 					/* here is where code would go to check for target existence in extensions.conf files */
-					struct pbx_find_info pfiq;
 #ifdef STANDALONE
+					struct pbx_find_info pfiq = {.stacklen = 0 };
 					extern int localized_pbx_load_module(void);
 					/* if this is a standalone, we will need to make sure the 
 					   localized load of extensions.conf is done */
@@ -1343,7 +1343,6 @@
 						localized_pbx_load_module();
 						extensions_dot_conf_loaded++;
 					}
-#endif
 
 					pbx_find_extension(NULL, NULL, &pfiq, first->u1.str, second->u1.str, atoi(third->u1.str),
 											atoi(third->u1.str) ? NULL : third->u1.str, NULL, 
@@ -1354,6 +1353,11 @@
 								item->filename, item->startline, item->endline, first->u1.str, second->u1.str, third->u1.str);
 						warns++;
 					}
+#else
+					ast_log(LOG_WARNING,"Warning: file %s, line %d-%d: goto:  Couldn't find goto target %s|%s|%s in the AEL code!\n",
+							item->filename, item->startline, item->endline, first->u1.str, second->u1.str, third->u1.str);
+					warns++;
+#endif
 				}
 			} else {
 				struct pval *mac = in_macro(item); /* is this goto inside a macro? */
@@ -2379,7 +2383,9 @@
 #endif
 		macro_def = find_macro(item->u1.str);
 		if (!macro_def) {
-			struct pbx_find_info pfiq;
+#ifdef STANDALONE
+			struct pbx_find_info pfiq = {.stacklen = 0 };
+			struct pbx_find_info pfiq2 = {.stacklen = 0 };
 
 			/* look for the macro in the extensions.conf world */
 			pbx_find_extension(NULL, NULL, &pfiq, item->u1.str, "s", 1, NULL, NULL, E_MATCH);
@@ -2389,9 +2395,9 @@
 				snprintf(namebuf2, 256, "macro-%s", item->u1.str);
 				
 				/* look for the macro in the extensions.conf world */
-				pbx_find_extension(NULL, NULL, &pfiq, namebuf2, "s", 1, NULL, NULL, E_MATCH);
+				pbx_find_extension(NULL, NULL, &pfiq2, namebuf2, "s", 1, NULL, NULL, E_MATCH);
 				
-				if (pfiq.status == STATUS_SUCCESS) {
+				if (pfiq2.status == STATUS_SUCCESS) {
 					ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: macro call to non-existent %s! (macro-%s was found in the extensions.conf stuff, but we are using gosubs!)\n",
 							item->filename, item->startline, item->endline, item->u1.str, item->u1.str);
 					warns++;
@@ -2401,7 +2407,12 @@
 					warns++;
 				}
 			}
-
+#else
+			ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: macro call to %s cannot be found in the AEL code!\n",
+					item->filename, item->startline, item->endline, item->u1.str);
+			warns++;
+			
+#endif
 #ifdef THIS_IS_1DOT4
 			char namebuf2[256];
 			snprintf(namebuf2, 256, "macro-%s", item->u1.str);
@@ -2410,7 +2421,7 @@
 			pbx_find_extension(NULL, NULL, &pfiq, namebuf2, "s", 1, NULL, NULL, E_MATCH);
 			
 			if (pfiq.status != STATUS_SUCCESS) {
-				ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: macro call to non-existent %s!\n",
+				ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: macro call to %s was not found in the AEL, nor the extensions.conf !\n",
 						item->filename, item->startline, item->endline, item->u1.str);
 				warns++;
 			}

Modified: team/murf/bug_7638/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/Makefile?view=diff&rev=59184&r1=59183&r2=59184
==============================================================================
--- team/murf/bug_7638/utils/Makefile (original)
+++ team/murf/bug_7638/utils/Makefile Thu Mar 22 20:15:00 2007
@@ -58,7 +58,7 @@
 clean:
 	rm -f *.o $(ALL_UTILS) check_expr
 	rm -f .*.o.d .*.oo.d
-	rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c
+	rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c pval.c
 	rm -f aelparse.c aelbison.c conf2ael
 
 md5.c: ../main/md5.c

Modified: team/murf/bug_7638/utils/check_expr.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/check_expr.c?view=diff&rev=59184&r1=59183&r2=59184
==============================================================================
--- team/murf/bug_7638/utils/check_expr.c (original)
+++ team/murf/bug_7638/utils/check_expr.c Thu Mar 22 20:15:00 2007
@@ -22,6 +22,59 @@
 #include <string.h>
 #include <stdlib.h>
 #include <../include/asterisk/ast_expr.h>
+#define AST_API_MODULE 1
+#include "asterisk/inline_api.h"
+#include "asterisk/strings.h"
+
+/* I included this from utils.c, so as not to have everything in that .c
+   file included */
+/*!
+ * core handler for dynamic strings.
+ * This is not meant to be called directly, but rather through the
+ * various wrapper macros
+ *	ast_str_set(...)
+ *	ast_str_append(...)
+ *	ast_str_set_va(...)
+ *	ast_str_append_va(...)
+ */
+int __ast_str_helper(struct ast_str **buf, size_t max_len,
+	int append, const char *fmt, va_list ap)
+{
+	int res, need;
+	int offset = (append && (*buf)->len) ? (*buf)->used : 0;
+
+	if (max_len < 0)
+		max_len = (*buf)->len;	/* don't exceed the allocated space */
+	/*
+	 * Ask vsnprintf how much space we need. Remember that vsnprintf
+	 * does not count the final '\0' so we must add 1.
+	 */
+	res = vsnprintf((*buf)->str + offset, (*buf)->len - offset, fmt, ap);
+
+	need = res + offset + 1;
+	/*
+	 * If there is not enough space and we are below the max length,
+	 * reallocate the buffer and return a message telling to retry.
+	 */
+	if (need > (*buf)->len && (max_len == 0 || (*buf)->len < max_len) ) {
+		if (max_len && max_len < need)	/* truncate as needed */
+			need = max_len;
+		else if (max_len == 0)	/* if unbounded, give more room for next time */
+			need += 16 + need/4;
+		if (ast_str_make_space(buf, need)) {
+			return AST_DYNSTR_BUILD_FAILED;
+		}
+		(*buf)->str[offset] = '\0';	/* Truncate the partial write. */
+
+		/* va_end() and va_start() must be done before calling
+		 * vsnprintf() again. */
+		return AST_DYNSTR_BUILD_RETRY;
+	}
+	/* update space used, keep in mind the truncation */
+	(*buf)->used = (res + offset > (*buf)->len) ? (*buf)->len : res + offset;
+
+	return res;
+}
 
 static int global_lineno = 1;
 static int global_expr_count=0;

Modified: team/murf/bug_7638/utils/extconf.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/extconf.c?view=diff&rev=59184&r1=59183&r2=59184
==============================================================================
--- team/murf/bug_7638/utils/extconf.c (original)
+++ team/murf/bug_7638/utils/extconf.c Thu Mar 22 20:15:00 2007
@@ -49,7 +49,7 @@
 #include <pthread.h>
 #include <netdb.h>
 #include <sys/param.h>
-#define AST_INCLUDE_GLOB 1
+#define ASINCLUDE_GLOB 1
 #ifdef AST_INCLUDE_GLOB
 #if defined(__Darwin__) || defined(__CYGWIN__)
 #define GLOB_ABORTED GLOB_ABEND
@@ -58,6 +58,7 @@
 #endif
 
 static char ast_config_AST_CONFIG_DIR[PATH_MAX] = {"/etc/asterisk"};
+#define AST_API_MODULE  1 /* gimme the inline defs! */
 
 #include "asterisk/inline_api.h"
 #include "asterisk/compat.h"
@@ -4584,14 +4585,12 @@
 	struct ast_include *i;
 
 	/* Initialize status if appropriate */
-	q->stacklen = 0;
-	q->status = STATUS_NO_CONTEXT;
-	q->swo = NULL;
-	q->data = NULL;
-	q->foundcontext = NULL;
-	
-	/* Check for stack overflow */
-	if (q->stacklen >= AST_PBX_MAX_STACK) {
+	if (q->stacklen == 0) {
+		q->status = STATUS_NO_CONTEXT;
+		q->swo = NULL;
+		q->data = NULL;
+		q->foundcontext = NULL;
+	} else if (q->stacklen >= AST_PBX_MAX_STACK) {
 		ast_log(LOG_WARNING, "Maximum PBX stack exceeded\n");
 		return NULL;
 	}



More information about the svn-commits mailing list