[asterisk-commits] file: branch file/res_sorcery_realtime r384781 - in /team/file/res_sorcery_re...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 4 14:36:03 CDT 2013


Author: file
Date: Thu Apr  4 14:35:59 2013
New Revision: 384781

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384781
Log:
Incorporate review feedback. I'll update the actual review TOMORROW.

Modified:
    team/file/res_sorcery_realtime/include/asterisk/config.h
    team/file/res_sorcery_realtime/main/sorcery.c
    team/file/res_sorcery_realtime/res/res_config_ldap.c
    team/file/res_sorcery_realtime/res/res_config_odbc.c

Modified: team/file/res_sorcery_realtime/include/asterisk/config.h
URL: http://svnview.digium.com/svn/asterisk/team/file/res_sorcery_realtime/include/asterisk/config.h?view=diff&rev=384781&r1=384780&r2=384781
==============================================================================
--- team/file/res_sorcery_realtime/include/asterisk/config.h (original)
+++ team/file/res_sorcery_realtime/include/asterisk/config.h Thu Apr  4 14:35:59 2013
@@ -589,6 +589,7 @@
  */
 int ast_realtime_is_mapping_defined(const char *family);
 
+#ifdef TEST_FRAMEWORK
 /*!
  * \brief Add an explicit mapping for a family
  *
@@ -598,7 +599,6 @@
  * \param table Table to use
  * \param priority Priority of this mapping
  */
-#ifdef TEST_FRAMEWORK
 int ast_realtime_append_mapping(const char *name, const char *driver, const char *database, const char *table, int priority);
 #endif
 

Modified: team/file/res_sorcery_realtime/main/sorcery.c
URL: http://svnview.digium.com/svn/asterisk/team/file/res_sorcery_realtime/main/sorcery.c?view=diff&rev=384781&r1=384780&r2=384781
==============================================================================
--- team/file/res_sorcery_realtime/main/sorcery.c (original)
+++ team/file/res_sorcery_realtime/main/sorcery.c Thu Apr  4 14:35:59 2013
@@ -545,7 +545,7 @@
 	int pos;
 	va_list args;
 
-	if (!object_type || !object_type->type.item_alloc) {
+	if (!strcmp(type, "id") || !object_type || !object_type->type.item_alloc) {
 		return -1;
 	}
 

Modified: team/file/res_sorcery_realtime/res/res_config_ldap.c
URL: http://svnview.digium.com/svn/asterisk/team/file/res_sorcery_realtime/res/res_config_ldap.c?view=diff&rev=384781&r1=384780&r2=384781
==============================================================================
--- team/file/res_sorcery_realtime/res/res_config_ldap.c (original)
+++ team/file/res_sorcery_realtime/res/res_config_ldap.c Thu Apr  4 14:35:59 2013
@@ -941,17 +941,41 @@
 	return vars;
 }
 
+static struct ast_variable *realtime_arguments_to_fields(va_list ap)
+{
+	struct ast_variable *fields = NULL;
+	const char *newparam, *newval;
+
+	while ((newparam = va_arg(ap, const char *))) {
+		struct ast_variable *field;
+
+		newval = va_arg(ap, const char *);
+		if (!(field = ast_variable_new(newparam, newval, ""))) {
+			ast_variables_destroy(fields);
+			return NULL;
+		}
+
+		field->next = fields;
+		fields = field;
+	}
+
+	return fields;
+}
+
 /*! \brief same as realtime_ldap_base_ap but take variable arguments count list
  */
 static struct ast_variable **realtime_ldap_base(unsigned int *entries_count_ptr,
 	const char *basedn, const char *table_name, ...)
 {
+	RAII_VAR(struct ast_variable *, fields, NULL, ast_variables_destroy);
 	struct ast_variable **vars = NULL;
 	va_list ap;
 
 	va_start(ap, table_name);
-//	vars = realtime_ldap_base_ap(entries_count_ptr, basedn, table_name, ap);
+	fields = realtime_arguments_to_fields(ap);
 	va_end(ap);
+
+	vars = realtime_ldap_base_ap(entries_count_ptr, basedn, table_name, fields);
 
 	return vars;
 }

Modified: team/file/res_sorcery_realtime/res/res_config_odbc.c
URL: http://svnview.digium.com/svn/asterisk/team/file/res_sorcery_realtime/res/res_config_odbc.c?view=diff&rev=384781&r1=384780&r2=384781
==============================================================================
--- team/file/res_sorcery_realtime/res/res_config_odbc.c (original)
+++ team/file/res_sorcery_realtime/res/res_config_odbc.c Thu Apr  4 14:35:59 2013
@@ -166,7 +166,7 @@
 	struct ast_flags connected_flag = { RES_ODBC_CONNECTED };
 
 	if (!fields) {
-	  return NULL;
+		return NULL;
 	}
 
 	if (ast_string_field_init(&cps, 256)) {




More information about the asterisk-commits mailing list