[Asterisk-cvs] asterisk/pbx pbx_realtime.c,1.1,1.2

markster at lists.digium.com markster at lists.digium.com
Mon Nov 22 00:03:15 CST 2004


Update of /usr/cvsroot/asterisk/pbx
In directory mongoose.digium.com:/tmp/cvs-serv32230/pbx

Modified Files:
	pbx_realtime.c 
Log Message:
Minor realtime improvements


Index: pbx_realtime.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_realtime.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pbx_realtime.c	22 Nov 2004 03:25:27 -0000	1.1
+++ pbx_realtime.c	22 Nov 2004 05:03:03 -0000	1.2
@@ -50,13 +50,13 @@
 */
 
 
-#define REALTIME_COMMON \
+#define REALTIME_COMMON(mode) \
 	char *buf; \
 	char *opts; \
 	const char *cxt; \
 	char *table; \
 	int res=-1; \
-	struct ast_variable *var; \
+	struct ast_variable *var=NULL; \
 	buf = ast_strdupa(data); \
 	if (buf) { \
 		opts = strchr(buf, '/'); \
@@ -75,9 +75,9 @@
 			cxt = context;\
 		if (!table || ast_strlen_zero(table)) \
 			table = "extensions"; \
-		var = realtime_switch_common(table, cxt, exten, priority); \
+		var = realtime_switch_common(table, cxt, exten, priority, mode); \
 	} else \
-		return -1; 
+		res = -1; 
 
 static struct ast_variable *realtime_switch_common(const char *table, const char *context, const char *exten, int priority)
 {
@@ -104,7 +104,7 @@
 	if (var) ast_destroy_realtime(var);
 	if (var)
 		res = 1;
-	return res;
+	return res > 0 ? res : 0;
 }
 
 static int realtime_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data)
@@ -123,6 +123,7 @@
 				appdata = ast_strdupa(v->value);
 			v = v->next;
 		}
+		ast_destroy_realtime(var);
 		if (!ast_strlen_zero(app)) {
 			a = pbx_findapp(app);
 			if (a) {
@@ -130,7 +131,6 @@
 			} else
 				ast_log(LOG_NOTICE, "No such application '%s' for extension '%s' in context '%s'\n", app, exten, context);
 		}
-		ast_destroy_realtime(var);
 	}
 	return res;
 }
@@ -139,7 +139,7 @@
 {
 	REALTIME_COMMON;
 	if (var) ast_destroy_realtime(var);
-	return res;
+	return res > 0 ? res : 0;
 }
 
 static struct ast_switch realtime_switch =




More information about the svn-commits mailing list