From 51a88d4fff9beb151e4d2ced02685e2608114eff Mon Sep 17 00:00:00 2001 From: ellson Date: Tue, 5 Apr 2005 15:43:26 +0000 Subject: [PATCH] Disable config code when DISABLE_LTDL (avoid incllude of glob.h) --- lib/gvc/gvc.h | 1 - lib/gvc/gvconfig.c | 30 +++++++++++++++++++++++++----- lib/gvc/gvplugin.c | 24 ------------------------ 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/lib/gvc/gvc.h b/lib/gvc/gvc.h index 284e21faf..a5a479fd3 100644 --- a/lib/gvc/gvc.h +++ b/lib/gvc/gvc.h @@ -43,7 +43,6 @@ extern "C" { extern gv_plugin_t *gvplugin_load(GVC_t * gvc, api_t api, char *type); extern gvplugin_library_t *gvplugin_library_load(char *path); extern const char *gvplugin_list(GVC_t * gvc, api_t api, char *str); - extern void gvplugin_builtins(GVC_t * gvc); extern api_t gvplugin_api(char *str); extern char * gvplugin_api_name(api_t api); diff --git a/lib/gvc/gvconfig.c b/lib/gvc/gvconfig.c index 69f9f300c..40d603550 100644 --- a/lib/gvc/gvconfig.c +++ b/lib/gvc/gvconfig.c @@ -17,10 +17,12 @@ #include #include #include +#ifndef DISABLE_LTDL #include #include #include #include +#endif #include "config.h" #include "types.h" @@ -125,36 +127,53 @@ static char *token(int *nest, char **tokens) return t; } +#ifdef DISABLE_LTDL +extern gvplugin_library_t *builtins[]; +#endif + /* gvconfig - parse a config file and install the identified plugins */ void gvconfig(GVC_t * gvc) { + gvplugin_library_t *library; + gvplugin_api_t *apis; + gvplugin_type_t *types; + int i +#ifndef DISABLE_LTDL char *s, *path, *api, *type; api_t gv_api; int quality; int nest = 0; - int sz, rc, i, j; + int sz, rc, j; struct stat config_st, libdir_st; FILE *f; char *config_path, *config_glob, *home, *config_text; glob_t globbuf; - gvplugin_library_t *library; - gvplugin_api_t *apis; - gvplugin_type_t *types; char *dot_graphviz = "/.graphviz"; char *libdir = GVLIBDIR; char *plugin_glob = "/libgvplugin*.so.0"; #define MAX_SZ_CONFIG 100000 +#endif #ifndef DISABLE_CODEGENS config_codegen_builtins(gvc); #endif - gvplugin_builtins(gvc); +#ifdef DISABLE_LTDL + for (library = builtins; *library; library++) { + for (apis = (*library)->apis; (types = apis->types); apis++) { + for (i = 0; types[i].type; i++) { + gvplugin_install(gvc, apis->api, + types[i].type, types[i].quality, + (*library)->name, &types[i]); + } + } + } +#else /* see if there are any new plugins */ rc = stat(libdir, &libdir_st); @@ -268,4 +287,5 @@ void gvconfig(GVC_t * gvc) } while (nest == 2); } while (nest == 1); } +#endif } diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c index 581374231..9d3d4cf07 100644 --- a/lib/gvc/gvplugin.c +++ b/lib/gvc/gvplugin.c @@ -288,27 +288,3 @@ const char *gvplugin_list(GVC_t * gvc, api_t api, char *str) free(s); return buf; } - -#ifdef DISABLE_LTDL -extern gvplugin_library_t *builtins[]; -#endif - -void gvplugin_builtins(GVC_t * gvc) -{ -#ifdef DISABLE_LTDL - gvplugin_library_t **library; - gvplugin_api_t *apis; - gvplugin_type_t *types; - int i; - - for (library = builtins; *library; library++) { - for (apis = (*library)->apis; (types = apis->types); apis++) { - for (i = 0; types[i].type; i++) { - gvplugin_install(gvc, apis->api, - types[i].type, types[i].quality, - (*library)->name, &types[i]); - } - } - } -#endif -} -- 2.40.0