*/
-static gvplugin_package_t * gvplugin_package_record(GVC_t * gvc, const char *path, const char *name)
-{
+static gvplugin_package_t * gvplugin_package_record(GVC_t * gvc,
+ const char *package_path,
+ const char *name) {
gvplugin_package_t *package = gmalloc(sizeof(gvplugin_package_t));
- package->path = (path) ? strdup(path) : NULL;
+ package->path = package_path ? strdup(package_path) : NULL;
package->name = strdup(name);
package->next = gvc->packages;
gvc->packages = package;
static int gvconfig_plugin_install_from_config(GVC_t * gvc, char *s)
{
- char *path, *name, *api;
+ char *package_path, *name, *api;
const char *type;
api_t gv_api;
int quality, rc;
separator(&nest, &s);
while (*s) {
- path = token(&nest, &s);
+ package_path = token(&nest, &s);
if (nest == 0)
name = token(&nest, &s);
else
name = "x";
- package = gvplugin_package_record(gvc, path, name);
+ package = gvplugin_package_record(gvc, package_path, name);
do {
api = token(&nest, &s);
gv_api = gvplugin_api(api);
rc = gvplugin_install (gvc, gv_api,
type, quality, package, NULL);
if (!rc) {
- agerr(AGERR, "config error: %s %s %s\n", path, api, type);
+ agerr(AGERR, "config error: %s %s %s\n", package_path, api, type);
return 0;
}
}
}
#endif
-void gvconfig_plugin_install_from_library(GVC_t * gvc, char *path, gvplugin_library_t *library)
-{
+void gvconfig_plugin_install_from_library(GVC_t * gvc, char *package_path,
+ gvplugin_library_t *library) {
gvplugin_api_t *apis;
gvplugin_installed_t *types;
gvplugin_package_t *package;
int i;
- package = gvplugin_package_record(gvc, path, library->packagename);
+ package = gvplugin_package_record(gvc, package_path, library->packagename);
for (apis = library->apis; (types = apis->types); apis++) {
for (i = 0; types[i].type; i++) {
gvplugin_install(gvc, apis->api, types[i].type,
}
#ifdef ENABLE_LTDL
-static void gvconfig_write_library_config(GVC_t *gvc, char *path, gvplugin_library_t *library, FILE *f)
-{
+static void gvconfig_write_library_config(GVC_t *gvc, char *lib_path,
+ gvplugin_library_t *library,
+ FILE *f) {
gvplugin_api_t *apis;
gvplugin_installed_t *types;
int i;
- fprintf(f, "%s %s {\n", path, library->packagename);
+ fprintf(f, "%s %s {\n", lib_path, library->packagename);
for (apis = library->apis; (types = apis->types); apis++) {
fprintf(f, "\t%s {\n", gvplugin_api_name(apis->api));
for (i = 0; types[i].type; i++) {
#ifdef HAVE_DL_ITERATE_PHDR
static int line_callback(struct dl_phdr_info *info, size_t size, void *line)
{
- const char *path = info->dlpi_name;
- char *tmp = strstr(path, "/libgvc.");
+ const char *p = info->dlpi_name;
+ char *tmp = strstr(p, "/libgvc.");
(void) size;
if (tmp) {
*tmp = 0;
/* Check for real /lib dir. Don't accept pre-install /.libs */
- if (strcmp(strrchr(path,'/'), DOTLIBS) != 0) {
- memmove(line, path, strlen(path) + 1); /* use line buffer for result */
+ if (strcmp(strrchr(p,'/'), DOTLIBS) != 0) {
+ memmove(line, p, strlen(p) + 1); // use line buffer for result
strcat(line, "/graphviz"); /* plugins are in "graphviz" subdirectory */
return 1;
}
#ifdef __APPLE__
uint32_t i, c = _dyld_image_count();
size_t len, ind;
- const char* path;
for (i = 0; i < c; ++i) {
- path = _dyld_get_image_name(i);
- const char* tmp = strstr(path, "/libgvc.");
+ const char *p = _dyld_get_image_name(i);
+ const char* tmp = strstr(p, "/libgvc.");
if (tmp) {
- if (tmp > path) {
+ if (tmp > p) {
/* Check for real /lib dir. Don't accept pre-install /.libs */
const char *s = tmp - 1;
/* back up to previous slash (or head of string) */
- while ((*s != '/') && (s > path)) s--;
+ while (*s != '/' && s > p) s--;
if (strncmp (s, DOTLIBS, STRLEN(DOTLIBS)) == 0)
continue;
}
- ind = tmp - path; /* byte offset */
+ ind = tmp - p; // byte offset
len = ind + sizeof("/graphviz");
if (len < BSZ)
libdir = line;
else
libdir = gmalloc(len);
- bcopy (path, libdir, ind);
+ bcopy(p, libdir, ind);
/* plugins are in "graphviz" subdirectory */
strcpy(libdir+ind, "/graphviz");
break;
libdir = line;
#else
FILE* f = fopen ("/proc/self/maps", "r");
- char* path;
if (f) {
while (!feof (f)) {
if (!fgets (line, sizeof (line), f))
continue;
if (!strstr (line, " r-xp "))
continue;
- path = strchr (line, '/');
- if (!path)
+ char *p = strchr(line, '/');
+ if (!p)
continue;
- char* tmp = strstr (path, "/libgvc.");
+ char* tmp = strstr(p, "/libgvc.");
if (tmp) {
*tmp = 0;
/* Check for real /lib dir. Don't accept pre-install /.libs */
- if (strcmp(strrchr(path,'/'), "/.libs") == 0)
+ if (strcmp(strrchr(p, '/'), "/.libs") == 0)
continue;
- memmove(line, path, strlen(path) + 1); /* use line buffer for result */
+ memmove(line, p, strlen(p) + 1); // use line buffer for result
strcat(line, "/graphviz"); /* plugins are in "graphviz" subdirectory */
libdir = line;
break;
{
FILE *f = NULL;
glob_t globbuf;
- char *config_glob, *path, *libdir;
+ char *config_glob, *libdir;
int rc;
gvplugin_library_t *library;
#if defined(DARWIN_DYLIB)
if (is_plugin(globbuf.gl_pathv[i])) {
library = gvplugin_library_load(gvc, globbuf.gl_pathv[i]);
if (library) {
- path = strrchr(globbuf.gl_pathv[i],DIRSEP[0]);
- if (path)
- path++;
- if (f && path)
- gvconfig_write_library_config(gvc, path, library, f);
+ char *p = strrchr(globbuf.gl_pathv[i], DIRSEP[0]);
+ if (p)
+ p++;
+ if (f && p)
+ gvconfig_write_library_config(gvc, p, library, f);
}
}
}