Now using EINA_ARRAY_ITER_NEXT.

[]'s
-- 
Fabiano Fidêncio
ProFUSION embedded systems
http://www.profusion.mobi
--- eina_module.c_bkp	2009-11-17 14:37:47.597794569 -0200
+++ eina_module.c	2009-11-18 14:19:17.503699041 -0200
@@ -547,6 +547,37 @@
 }
 
 /**
+ * @brief Find an module in array.
+ *
+ * @param array The array to find the module.
+ * @param module The name of module to be searched;
+ *
+ * This function finds an @p module in an @p array;
+ * If the element is found return the module else NULL.
+ */
+EAPI Eina_Module *
+eina_module_find(Eina_Array *array, char *module)
+{
+   unsigned int i;
+   Eina_Array_Iterator iterator;
+   Eina_Module *m;
+
+   EINA_ARRAY_ITER_NEXT(array, i, m, iterator)
+   {
+      const char *file_m;
+      ssize_t len;
+
+      file_m = basename(eina_module_file_get(m));
+      len = strlen(file_m);
+      len -= sizeof(MODULE_EXTENSION) - 1;
+      if (len <= 0) continue;
+      if (!strncmp(module, file_m, len)) return m;
+   }
+
+   return NULL;
+}
+
+/**
  * Load every module on the list of modules
  * @param array The array of modules to load
  */
--- eina_module.h	2009-11-17 16:39:35.586262965 -0200
+++ eina_module.h	2009-11-17 16:39:06.136042399 -0200
@@ -70,6 +70,7 @@
 EAPI void eina_module_list_load(Eina_Array *list) EINA_ARG_NONNULL(1);
 EAPI void eina_module_list_unload(Eina_Array *list) EINA_ARG_NONNULL(1);
 EAPI void eina_module_list_flush(Eina_Array *list) EINA_ARG_NONNULL(1);
+EAPI Eina_Module * eina_module_find(Eina_Array *array, char *module);
 /**
  * @}
  */
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to