[asterisk-commits] file: branch file/res_sorcery_realtime r384084 - /team/file/res_sorcery_realt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 27 12:27:25 CDT 2013


Author: file
Date: Wed Mar 27 12:27:21 2013
New Revision: 384084

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384084
Log:
Order matters, for the first field only. >_>

Modified:
    team/file/res_sorcery_realtime/main/config.c

Modified: team/file/res_sorcery_realtime/main/config.c
URL: http://svnview.digium.com/svn/asterisk/team/file/res_sorcery_realtime/main/config.c?view=diff&rev=384084&r1=384083&r2=384084
==============================================================================
--- team/file/res_sorcery_realtime/main/config.c (original)
+++ team/file/res_sorcery_realtime/main/config.c Wed Mar 27 12:27:21 2013
@@ -2513,21 +2513,29 @@
 
 static struct ast_variable *realtime_arguments_to_fields(va_list ap)
 {
-	struct ast_variable *fields = NULL;
-	const char *newparam;
+	struct ast_variable *first, *fields = NULL;
+	const char *newparam = va_arg(ap, const char *), *newval = va_arg(ap, const char *);
+
+	if (!(first = ast_variable_new(newparam, newval, ""))) {
+		return NULL;
+	}
 
 	while ((newparam = va_arg(ap, const char *))) {
-		const char *newval = va_arg(ap, const char *);
-		struct ast_variable *field = ast_variable_new(newparam, newval, "");
-
-		if (!field) {
+		struct ast_variable *field;
+
+		newval = va_arg(ap, const char *);
+		if (!(field = ast_variable_new(newparam, newval, ""))) {
 			ast_variables_destroy(fields);
+			ast_variables_destroy(first);
 			return NULL;
 		}
 
 		field->next = fields;
 		fields = field;
 	}
+
+	first->next = fields;
+	fields = first;
 
 	return fields;
 }




More information about the asterisk-commits mailing list