#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#ifdef ENABLE_NLS
+# include <libintl.h>
+#endif
#include "config/configuration.h"
vlc_mutex_unlock( &module_lock );
#ifdef HAVE_DYNAMIC_PLUGINS
- if( p_bank->b_cache )
- CacheSave( p_this, p_bank );
while( p_bank->i_loaded_cache-- )
{
if( p_bank->pp_loaded_cache[p_bank->i_loaded_cache] )
if( p_module_bank->b_cache || b_cache_delete )
CacheLoad( p_this, p_module_bank, b_cache_delete );
AllocateAllPlugins( p_this, p_module_bank );
+ if( p_module_bank->b_cache )
+ CacheSave( p_this, p_bank );
config_UnsortConfig ();
config_SortConfig ();
}
return m->i_score;
}
+/**
+ * Translate a string using the module's text domain
+ *
+ * \param m the module
+ * \param str the American English ASCII string to localize
+ * \return the gettext-translated string
+ */
+const char *module_gettext (const module_t *m, const char *str)
+{
+#ifdef ENABLE_NLS
+ const char *domain = m->domain ? m->domain : PACKAGE_NAME;
+ return dgettext (domain, str);
+#else
+ (void)m;
+ return str;
+#endif
+}
+
module_t *module_hold (module_t *m)
{
vlc_hold (&m->vlc_gc_data);
AllocatePluginDir (p_this, p_bank, path, i_maxdepth - 1);
else
if (S_ISREG (st.st_mode)
- && ((size_t)pathlen >= strlen (LIBEXT))
- && !strncasecmp (path + pathlen - strlen (LIBEXT), LIBEXT,
- strlen (LIBEXT)))
- /* ^^ We only load files ending with LIBEXT */
+ && strncmp (path, "lib", 3)
+ && ((size_t)pathlen >= sizeof ("_plugin"LIBEXT))
+ && !strncasecmp (path + pathlen - strlen ("_plugin"LIBEXT),
+ "_plugin"LIBEXT, strlen ("_plugni"LIBEXT)))
+ /* ^^ We only load files matching "lib*_plugin"LIBEXT */
AllocatePluginFile (p_this, p_bank, path, st.st_mtime, st.st_size);
free (path);
p_module = AllocatePlugin( p_this, psz_file );
}
else
- /* If junk dll, don't try to load it */
- if( p_cache_entry->b_junk )
- return -1;
- else
{
module_config_t *p_item = NULL, *p_end = NULL;
p_module = p_cache_entry->p_module;
p_module->b_loaded = false;
+ /* If plugin-path contains duplicate entries... */
+ if( p_module->next != NULL )
+ return 0; /* already taken care of that one */
+
/* For now we force loading if the module's config contains
* callbacks or actions.
* Could be optimized by adding an API call.*/
break;
}
}
- if( p_module == p_cache_entry->p_module )
- p_cache_entry->b_used = true;
}
if( p_module == NULL )
return -1;
+ /* We have not already scanned and inserted this module */
+ assert( p_module->next == NULL );
+
/* Everything worked fine !
* The module is ready to be added to the list. */
p_module->b_builtin = false;
p_module->psz_object_name, p_module->psz_longname ); */
p_module->next = p_bank->head;
p_bank->head = p_module;
+ assert( p_module->next != NULL ); /* Insertion done */
if( !p_module_bank->b_cache )
return 0;
pp_cache[p_bank->i_cache]->psz_file = strdup( psz_file );
pp_cache[p_bank->i_cache]->i_time = i_file_time;
pp_cache[p_bank->i_cache]->i_size = i_file_size;
- pp_cache[p_bank->i_cache]->b_junk = p_module ? 0 : 1;
- pp_cache[p_bank->i_cache]->b_used = true;
pp_cache[p_bank->i_cache]->p_module = p_module;
p_bank->pp_cache = pp_cache;
p_bank->i_cache++;
p_module->psz_longname = strdup( p_module->psz_longname );
p_module->psz_help = p_module->psz_help ? strdup( p_module->psz_help )
: NULL;
+ p_module->domain = p_module->domain ? strdup( p_module->domain ) : NULL;
for (module_t *subm = p_module->submodule; subm; subm = subm->next)
DupModule (subm);
FREENULL( p_module->psz_shortname );
free( p_module->psz_longname );
FREENULL( p_module->psz_help );
+ free( p_module->domain );
}
#endif /* HAVE_DYNAMIC_PLUGINS */