Added ec_master_find_domain_const().
authorFlorian Pose <fp@igh-essen.com>
Wed, 02 Jul 2008 09:22:55 +0000
changeset 1078 fce58ba8a912
parent 1077 c95cd717b852
child 1079 ef1266652c4d
Added ec_master_find_domain_const().
master/master.c
master/master.h
--- a/master/master.c	Wed Jul 02 08:14:47 2008 +0000
+++ b/master/master.c	Wed Jul 02 09:22:55 2008 +0000
@@ -1124,20 +1124,35 @@
 
 /*****************************************************************************/
 
+#define EC_FIND_DOMAIN \
+    do { \
+        list_for_each_entry(domain, &master->domains, list) { \
+            if (index--) \
+                continue; \
+            return domain; \
+        } \
+        \
+        return NULL; \
+    } while (0)
+
 ec_domain_t *ec_master_find_domain(
 		ec_master_t *master, /**< EtherCAT master. */
 		unsigned int index /**< Domain index. */
 		)
 {
 	ec_domain_t *domain;
-
-	list_for_each_entry(domain, &master->domains, list) {
-		if (index--)
-			continue;
-		return domain;
-	}
-
-	return NULL;
+    EC_FIND_DOMAIN;
+}
+
+/*****************************************************************************/
+
+const ec_domain_t *ec_master_find_domain_const(
+		const ec_master_t *master, /**< EtherCAT master. */
+		unsigned int index /**< Domain index. */
+		)
+{
+	const ec_domain_t *domain;
+    EC_FIND_DOMAIN;
 }
 
 /*****************************************************************************/
--- a/master/master.h	Wed Jul 02 08:14:47 2008 +0000
+++ b/master/master.h	Wed Jul 02 09:22:55 2008 +0000
@@ -203,6 +203,8 @@
         const ec_master_t *, unsigned int);
 unsigned int ec_master_domain_count(const ec_master_t *);
 ec_domain_t *ec_master_find_domain(ec_master_t *, unsigned int);
+const ec_domain_t *ec_master_find_domain_const(const ec_master_t *,
+        unsigned int);
 
 int ec_master_debug_level(ec_master_t *, int);