[xml] Replace 2 shl_findsym() calls in xmlmodule with 1



Why do you have two calls to shl_findsym on HP-UX? From the shl_load
man page:
           ...  The type argument specifies the expected type for
           the symbol, and should be one of the defined constants
           TYPE_PROCEDURE, TYPE_DATA, or TYPE_UNDEFINED.  The latter value
           suppresses type checking.  These are the only accepted type
           arguments on PA-RISC 64-bit systems.  On PA-RISC 32i-bit systems,
           you can also specify TYPE_STORAGE, or TYPE_TSTORAGE. ...

libltdl in libtool uses TYPE_UNDEFINED. Perl uses
TYPE_PROCEDURE/TYPE_DATA like you do now. Python and Glib use
TYPE_UNDEFINED. Why be so specific? The user should know what symbol
they're looking for so we're just interested in resolving the symbol,
regardless of the type. This simplifies the code as well.

Patch against 2.6.22 (will collide with my recent shl_findsym() patch
to get it working on HP-UX).

-- 
albert chin (china thewrittenword com)

-- snip snip
Index: xmlmodule.c
===================================================================
--- xmlmodule.c.orig    2005-07-28 18:58:57.000000000 -0500
+++ xmlmodule.c 2005-10-28 01:07:10.754426000 -0500
@@ -276,11 +280,7 @@
 {
     int rc;
 
-    errno = 0;
-    rc = shl_findsym(handle, name, TYPE_PROCEDURE, symbol);
-    if ((-1 == rc) && (0 == errno)) {
-        rc = shl_findsym(handle, name, TYPE_DATA, symbol);
-    }
+    rc = shl_findsym(&handle, name, TYPE_UNDEFINED, symbol);
     return rc;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]