What do you  mean by never defined? HAVE_DLFCN_H is defined by the
configure script (in config.h) if that function is available!

On Sun, Dec 6, 2009 at 6:47 PM, Carlos R. Mafra <[email protected]> wrote:
> HAVE_DLFCN_H is never defined.
> ---
>  src/defaults.c |   19 +------------
>  src/texture.c  |   42 +----------------------------
>  util/wmsetbg.c |   80 
> --------------------------------------------------------
>  3 files changed, 2 insertions(+), 139 deletions(-)
>
> diff --git a/src/defaults.c b/src/defaults.c
> index 6796309..984f7e7 100644
> --- a/src/defaults.c
> +++ b/src/defaults.c
> @@ -36,10 +36,6 @@
>  #include <limits.h>
>  #include <signal.h>
>
> -#ifdef HAVE_DLFCN_H
> -# include <dlfcn.h>
> -#endif
> -
>  #ifndef PATH_MAX
>  #define PATH_MAX DEFAULT_PATH_MAX
>  #endif
> @@ -1983,22 +1979,9 @@ static WTexture *parse_texture(WScreen * scr, 
> WMPropList * pl)
>                }
>
>                function = wTextureMakeFunction(scr, lib, func, argc, argv);
> -
> -#ifdef HAVE_DLFCN_H
> -               if (function) {
> -                       initFunc = dlsym(function->handle, "initWindowMaker");
> -                       if (initFunc) {
> -                               initFunc(dpy, scr->w_colormap);
> -                       } else {
> -                               wwarning(_("could not initialize library 
> %s"), lib);
> -                       }
> -               } else {
> -                       wwarning(_("could not find function %s::%s"), lib, 
> func);
> -               }
> -#endif                         /* HAVE_DLFCN_H */
>                texture = (WTexture *) function;
>        }
> -#endif                         /* TEXTURE_PLUGIN */
> +#endif /* TEXTURE_PLUGIN */
>        else {
>                wwarning(_("invalid texture type %s"), val);
>                return NULL;
> diff --git a/src/texture.c b/src/texture.c
> index 2029b2f..64565a2 100644
> --- a/src/texture.c
> +++ b/src/texture.c
> @@ -23,17 +23,9 @@
>
>  #include <X11/Xlib.h>
>  #include <X11/Xutil.h>
> -
> -#ifdef TEXTURE_PLUGIN
> -# ifdef HAVE_DLFCN_H
> -#  include <dlfcn.h>
> -# endif
> -#endif
> -
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <string.h>
> -
>  #include <wraster.h>
>
>  #include "WindowMaker.h"
> @@ -174,11 +166,6 @@ void wTextureDestroy(WScreen * scr, WTexture * texture)
>
>  #ifdef TEXTURE_PLUGIN
>        case WTEX_FUNCTION:
> -#ifdef HAVE_DLFCN_H
> -               if (texture->function.handle) {
> -                       dlclose(texture->function.handle);
> -               }
> -#endif
>                for (i = 0; i < texture->function.argc; i++) {
>                        wfree(texture->function.argv[i]);
>                }
> @@ -396,33 +383,12 @@ WTexFunction *wTextureMakeFunction(WScreen * scr, char 
> *lib, char *func, int arg
>        gcv.graphics_exposures = False;
>        texture->normal_gc = XCreateGC(dpy, scr->w_win, GCForeground | 
> GCBackground | GCGraphicsExposures, &gcv);
>
> -# ifdef HAVE_DLFCN_H
> -       /* open the library */
> -       texture->handle = dlopen(lib, RTLD_LAZY);
> -       if (!texture->handle) {
> -               wwarning(_("library \"%s\" cound not be opened."), lib);
> -               wfree(argv);
> -               wfree(texture);
> -               return NULL;
> -       }
> -
> -       /* find the function */
> -       texture->render = dlsym(texture->handle, func);
> -       if (!texture->render) {
> -               wwarning(_("function \"%s\" not found in library \"%s\""), 
> func, lib);
> -               wfree(argv);
> -               dlclose(texture->handle);
> -               wfree(texture);
> -               return NULL;
> -       }
> -# else
>        wwarning(_("function textures not supported on this system, sorry."));
> -# endif
>
>        /* success! */
>        return texture;
>  }
> -#endif                         /* TEXTURE_PLUGIN */
> +#endif  /* TEXTURE_PLUGIN */
>
>  RImage *wTextureRenderImage(WTexture * texture, int width, int height, int 
> relief)
>  {
> @@ -527,12 +493,6 @@ RImage *wTextureRenderImage(WTexture * texture, int 
> width, int height, int relie
>
>  #ifdef TEXTURE_PLUGIN
>        case WTEX_FUNCTION:
> -#ifdef HAVE_DLFCN_H
> -               if (texture->function.render) {
> -                       image = 
> texture->function.render(texture->function.argc, texture->function.argv,
> -                                                        width, height, 
> relief);
> -               }
> -#endif
>                if (!image) {
>                        RErrorCode = RERR_INTERNAL;
>                }
> diff --git a/util/wmsetbg.c b/util/wmsetbg.c
> index 96e14b5..f9173a4 100644
> --- a/util/wmsetbg.c
> +++ b/util/wmsetbg.c
> @@ -47,10 +47,6 @@
>  # endif
>  #endif
>
> -#ifdef HAVE_DLFCN_H
> -#include <dlfcn.h>
> -#endif
> -
>  #include "../src/wconfig.h"
>
>  #ifndef GLOBAL_DEFAULTS_SUBDIR
> @@ -662,84 +658,8 @@ BackgroundTexture *parseTexture(RContext * rc, char 
> *text)
>
>                texture->pixmap = pixmap;
>        } else if (strcasecmp(type, "function") == 0) {
> -#ifdef HAVE_DLFCN_H
> -               void (*initFunc) (Display *, Colormap);
> -               RImage *(*mainFunc) (int, char **, int, int, int);
> -               Pixmap pixmap;
> -               RImage *image = 0;
> -               int success = 0;
> -               char *lib, *func, **argv = 0;
> -               void *handle = 0;
> -               int i, argc;
> -
> -               if (count < 3)
> -                       goto function_cleanup;
> -
> -               /* get the library name */
> -               GETSTRORGOTO(val, lib, 1, function_cleanup);
> -
> -               /* get the function name */
> -               GETSTRORGOTO(val, func, 2, function_cleanup);
> -
> -               argc = count - 2;
> -               argv = (char **)wmalloc(argc * sizeof(char *));
> -
> -               /* get the parameters */
> -               argv[0] = func;
> -               for (i = 0; i < argc - 1; i++) {
> -                       GETSTRORGOTO(val, tmp, 3 + i, function_cleanup);
> -                       argv[i + 1] = wstrdup(tmp);
> -               }
> -
> -               handle = dlopen(lib, RTLD_LAZY);
> -               if (!handle) {
> -                       wwarning("could not find library %s", lib);
> -                       goto function_cleanup;
> -               }
> -
> -               initFunc = dlsym(handle, "initWindowMaker");
> -               if (!initFunc) {
> -                       wwarning("could not initialize library %s", lib);
> -                       goto function_cleanup;
> -               }
> -               initFunc(dpy, DefaultColormap(dpy, scr));
> -
> -               mainFunc = dlsym(handle, func);
> -               if (!mainFunc) {
> -                       wwarning("could not find function %s::%s", lib, func);
> -                       goto function_cleanup;
> -               }
> -               image = mainFunc(argc, argv, scrWidth, scrHeight, 0);
> -
> -               if (!RConvertImage(rc, image, &pixmap)) {
> -                       wwarning("could not convert texture:%s", 
> RMessageForError(RErrorCode));
> -                       goto function_cleanup;
> -               }
> -               texture->width = scrWidth;
> -               texture->height = scrHeight;
> -               texture->pixmap = pixmap;
> -               success = 1;
> -
> - function_cleanup:
> -               if (argv) {
> -                       int i;
> -                       for (i = 0; i < argc; i++) {
> -                               wfree(argv[i]);
> -                       }
> -               }
> -               if (handle) {
> -                       dlclose(handle);
> -               }
> -               if (image) {
> -                       RReleaseImage(image);
> -               }
> -               if (!success) {
> -                       goto error;
> -               }
> -#else
>                wwarning("function textures not supported");
>                goto error;
> -#endif
>        } else {
>                wwarning("invalid texture type %s", text);
>                goto error;
> --
> 1.6.6.rc0.61.g41d5b
>
>
> --
> To unsubscribe, send mail to [email protected].
>


--
To unsubscribe, send mail to [email protected].

Reply via email to