![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "system/macros.h"#include "system/mem_alloc.h"#include <stdlib.h>#include <string.h>#include <gmodule.h>#include <glib/gi18n.h>#include "config.h"#include "common/file_location.h"#include "common/logging.h"#include "common/module.h"#include "common/paths.h"#include "common/conf.h"
Include dependency graph for module.c:Go to the source code of this file.
Functions | |
| static gboolean | _manifest_entry_is_sane (const char *entry) |
| Is this manifest entry a plain module base name? | |
| gchar ** | dt_module_read_manifest (const char *subdir, char *moduledir) |
| Read a module directory's manifest and return the module base names it lists. | |
| GList * | dt_module_load_modules (const char *subdir, size_t module_size, int(*load_module_so)(void *module, const char *libname, const char *plugin_name), void(*init_module)(void *module), gint(*sort_modules)(gconstpointer a, gconstpointer b)) |
| Load every module the given directory's manifest lists. | |
|
static |
Is this manifest entry a plain module base name?
A manifest names the modules shipped in its own directory. Anything that could address a different one – a separator, a ‘..’, a leading dot – is refused rather than sanitised, because a manifest that says something we do not understand is a manifest we should not be acting on at all.
Definition at line 46 of file module.c.
References FALSE, IS_NULL_PTR, and TRUE.
Referenced by dt_module_read_manifest().
| GList * dt_module_load_modules | ( | const char * | subdir, |
| size_t | module_size, | ||
| int(*)(void *module, const char *libname, const char *plugin_name) | load_module_so, | ||
| void(*)(void *module) | init_module, | ||
| gint(*)(gconstpointer a, gconstpointer b) | sort_modules | ||
| ) |
Load every module the given directory's manifest lists.
Definition at line 106 of file module.c.
References dt_conf_get_bool(), dt_conf_key_exists(), dt_conf_set_bool(), dt_free, dt_module_read_manifest(), DT_PATH_MAX, IS_NULL_PTR, name, res, and TRUE.
Referenced by dt_lib_init(), and dt_view_manager_load_modules().
| gchar ** dt_module_read_manifest | ( | const char * | subdir, |
| char * | moduledir | ||
| ) |
Read a module directory's manifest and return the module base names it lists.
| subdir | directory under the module dir, e.g. "/views", leading separator included |
| moduledir | filled with the absolute directory the manifest was read from; must be at least DT_PATH_MAX bytes |
The base names are what g_module_build_path() expects: no ‘lib’ prefix, no file extension, no directory component. Entries carrying a path separator, a ‘..’, or a leading dot are rejected and reported: a manifest names the modules shipped in ITS directory and nothing else.
Definition at line 56 of file module.c.
References _manifest_entry_is_sane(), DT_DEBUG_ALWAYS, dt_loc_get_moduledir(), DT_MODULE_MANIFEST_NAME, DT_PATH_MAX, dt_print(), error(), FALSE, IS_NULL_PTR, and names.
Referenced by dt_imageio_load_modules_format(), dt_imageio_load_modules_storage(), and dt_module_load_modules().