[darwinbuild-changes] [35] trunk/darwinxref/DBPlugin.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:39:44 PDT 2006


Revision: 35
          http://trac.macosforge.org/projects/darwinbuild/changeset/35
Author:   kevin
Date:     2006-10-04 01:39:44 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
- allow plugins to be loaded from multiple directories

Modified Paths:
--------------
    trunk/darwinxref/DBPlugin.c

Modified: trunk/darwinxref/DBPlugin.c
===================================================================
--- trunk/darwinxref/DBPlugin.c	2005-07-07 22:43:39 UTC (rev 34)
+++ trunk/darwinxref/DBPlugin.c	2006-10-04 08:39:44 UTC (rev 35)
@@ -138,17 +138,13 @@
 	//
 	// Search the directories for plugins
 	//
+	FTSENT* ent;
 	FTS* dir = fts_open((char * const *)path_argv, FTS_LOGICAL, NULL);
-	(void)fts_read(dir);
-	FTSENT* ent = fts_children (dir, FTS_NAMEONLY);
-	while (ent != NULL) {
+	while ((ent = fts_read(dir)) != NULL) {
 		DBPlugin* plugin = NULL;
 		if (strstr(ent->fts_name, ".so")) {
-			char* filename;
-			asprintf(&filename, "%s/%s", ent->fts_accpath, ent->fts_name);
-//			fprintf(stderr, "plugin: loading %s\n", ent->fts_name);
-			void* handle = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
-			free(filename);
+	//		fprintf(stderr, "plugin: loading %s\n", ent->fts_accpath);
+			void* handle = dlopen(ent->fts_accpath, RTLD_LAZY | RTLD_LOCAL);
 			if (handle) {
 				DBPluginInitializeFunc func = dlsym(handle, "initialize");
 				plugin = _DBPluginInitialize();
@@ -160,12 +156,9 @@
 			}
 #if HAVE_TCL_PLUGINS
 		} else if (strstr(ent->fts_name, ".tcl")) {
-			char* filename;
-			asprintf(&filename, "%s/%s", ent->fts_accpath, ent->fts_name);
 			plugin = _DBPluginInitialize();
 			_DBPluginSetCurrentPlugin(plugin);
-			load_tcl_plugin(plugin, filename);	// Calls out to Tcl plugin
-			free(filename);
+			load_tcl_plugin(plugin, ent->fts_accpath);	// Calls out to Tcl plugin
 #endif
 		}
 		if (plugin) {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/1305cfb3/attachment.html


More information about the darwinbuild-changes mailing list