[asterisk-commits] eliel: branch group/data_api_gsoc2009 r206081 - in /team/group/data_api_gsoc2...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 12 14:02:39 CDT 2009


Author: eliel
Date: Sun Jul 12 14:02:34 2009
New Revision: 206081

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206081
Log:
Remove the general compare macro.

Modified:
    team/group/data_api_gsoc2009/include/asterisk/data.h
    team/group/data_api_gsoc2009/tests/test_data.c

Modified: team/group/data_api_gsoc2009/include/asterisk/data.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/include/asterisk/data.h?view=diff&rev=206081&r1=206080&r2=206081
==============================================================================
--- team/group/data_api_gsoc2009/include/asterisk/data.h (original)
+++ team/group/data_api_gsoc2009/include/asterisk/data.h Sun Jul 12 14:02:34 2009
@@ -149,16 +149,20 @@
 #define AST_DATA_STRUCTURE_MEMBER_ADDITIONAL(__name, __type, __structure, __additional) \
 	{ .name = #__name, .offset = offsetof(__structure, __name), 			\
 	.type = __type, .additional = (void *)__additional }
+#define AST_DATA_STRUCTURE_MEMBER_BIT(__name, __structure) { .name = #__name,		\
+	.type = AST_DATA_BOOLEAN, 
 
 struct ast_data_structure_mapping {
 	/*! \brief The name of the structure member. */
 	const char *name;
 	/*! \brief The offset of the member inside the structure. */
-	int offset;
+	size_t offset;
 	/*! \brief The type of the member. */
 	enum ast_data_type type;
 	/*! \brief Additional type specification. (depends of the type) */
 	void *additional;
+	/*! \brief bitfield access, only used if the type is boolean. */
+	int (*bitfield)(void *structure);
 };
 
 /*!
@@ -205,23 +209,11 @@
 int __ast_data_unregister(const char *path, const char *registrar);
 #define ast_data_unregister(path) __ast_data_unregister(path, __FILE__)
 
-#define ast_data_search_cmp(_root, _name, _value) ({					\
-	int __ret = 0;									\
-	if (__builtin_types_compatible_p(typeof(_value), int))				\
-		__ret  = ast_data_search_cmp_int(_root, _name, (void *) _value);	\
-	else if (__builtin_types_compatible_p(typeof(_value), char[]))			\
-		__ret = ast_data_search_cmp_string(_root, _name, (void *) _value);	\
-	else										\
-		abort();								\
-	__ret;										\
-})
-
 /*!
  * \brief Print out an ast_data tree to the console for debugging purposes.
  * \param[in] root The root node pointer of the data tree.
  */
 void ast_data_print_debug(const struct ast_data *root);
-
 
 /*!
  * \brief Based on a search tree, evaluate the specified 'name' inside the tree with the

Modified: team/group/data_api_gsoc2009/tests/test_data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/tests/test_data.c?view=diff&rev=206081&r1=206080&r2=206081
==============================================================================
--- team/group/data_api_gsoc2009/tests/test_data.c (original)
+++ team/group/data_api_gsoc2009/tests/test_data.c Sun Jul 12 14:02:34 2009
@@ -44,19 +44,19 @@
 {
 	struct ast_data *res, *internal;
 
-	if (ast_data_search_cmp(search, "root_test/data1", 10)) {
+	if (ast_data_search_cmp_int(search, "root_test/data1", 10)) {
 		ast_log(LOG_ERROR, "root_test/data1 doesn't match\n");
 	} else {
 		ast_log(LOG_ERROR, "root_test/data1 match!\n");
 	}
 
-	if (ast_data_search_cmp(search, "root_test/data2", 20)) {
+	if (ast_data_search_cmp_int(search, "root_test/data2", 20)) {
 		ast_log(LOG_ERROR, "root_test/data2 doesn't match\n");
 	} else {
 		ast_log(LOG_ERROR, "root_test/data2 match!\n");
 	}
 
-	if (ast_data_search_cmp(search, "root_test/name", "eliel")) {
+	if (ast_data_search_cmp_string(search, "root_test/name", "eliel")) {
 		ast_log(LOG_ERROR, "root_test/data2 doesn't match\n");
 	} else {
 		ast_log(LOG_ERROR, "root_test/data2 match!\n");




More information about the asterisk-commits mailing list