Hey Guys!
I had to implement an eina_module_find().
This function receive an array and a module name and returns the module (if
he's exists in list) or NULL if not.
If it is useful for something, please apply. :-)
--
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-17 16:02:14.274720194 -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_Bool
+eina_module_find(Eina_Array *array, char *module)
+{
+ int i;
+
+ for(i = 0; i < array->count; i++)
+ {
+ const char *file_data;
+ Eina_Module *data;
+ ssize_t len;
+
+ data = eina_array_data_get(array, i);
+ file_data = basename(eina_module_file_get(data));
+ len = strlen(file_data);
+ len -= strlen(MODULE_EXTENSION);
+ if (len <= 0) continue;
+ if (!strncmp(module, file_data, len)) return data;
+ }
+
+ return NULL;
+}
+
+/**
* Load every module on the list of modules
* @param array The array of modules to load
*/
------------------------------------------------------------------------------
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