libtool-patches
[Top][All Lists]
Advanced

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

FYI: 1-gary-unused-vars.patch


From: Gary V. Vaughan
Subject: FYI: 1-gary-unused-vars.patch
Date: Fri, 30 May 2003 17:26:28 +0100
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312

Applied to HEAD and branch-1-5 under the obvious bug rule.

Cheers,
        Gary.
--
  ())_. Gary V. Vaughan     gary@(oranda.demon.co.uk|gnu.org)
  ( '/  Research Scientist  http://www.oranda.demon.co.uk       ,_())____
  / )=  GNU Hacker          http://www.gnu.org/software/libtool  \'      `&
`(_~)_  Tech' Author        http://sources.redhat.com/autobook   =`---d__/
Index: ChangeLog
from  Gary V. Vaughan  <address@hidden>

        * libltdl/ltdl.c (lt_int_dyld_lib_install_name): Removed unused
        variable mh1.
        (sys_dyld_close): Removed unused variable size.

Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.174
diff -u -p -u -r1.174 ltdl.c
--- libltdl/ltdl.c 29 Mar 2003 04:09:00 -0000 1.174
+++ libltdl/ltdl.c 30 May 2003 15:19:08 -0000
@@ -1606,14 +1606,14 @@ static enum DYLD_BOOL (*ltdl_NSIsSymbolN
 static enum DYLD_BOOL (*ltdl_NSMakePrivateModulePublic)(NSModule module) = 0;
 
 #ifndef NSADDIMAGE_OPTION_NONE
-#define NSADDIMAGE_OPTION_NONE                          0x0    
+#define NSADDIMAGE_OPTION_NONE                          0x0
 #endif
 #ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR
 #define NSADDIMAGE_OPTION_RETURN_ON_ERROR               0x1
-#endif    
+#endif
 #ifndef NSADDIMAGE_OPTION_WITH_SEARCHING
 #define NSADDIMAGE_OPTION_WITH_SEARCHING                0x2
-#endif    
+#endif
 #ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED
 #define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED         0x4
 #endif
@@ -1622,7 +1622,7 @@ static enum DYLD_BOOL (*ltdl_NSMakePriva
 #endif
 #ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
 #define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND            0x0
-#endif   
+#endif
 #ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW
 #define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW        0x1
 #endif
@@ -1643,11 +1643,11 @@ lt_int_dyld_error(othererror)
        int lerno;
        const char *errstr;
        const char *file;
-       NSLinkEditError(&ler,&lerno,&file,&errstr);     
+       NSLinkEditError(&ler,&lerno,&file,&errstr);
        if (!errstr || !strlen(errstr)) errstr = othererror;
        return errstr;
 }
- 
+
 static const struct mach_header *
 lt_int_dyld_get_mach_header_from_nsmodule(module)
        NSModule module;
@@ -1671,7 +1671,7 @@ lt_int_dyld_get_mach_header_from_nsmodul
 
 static const char* lt_int_dyld_lib_install_name(mh)
        const struct mach_header *mh;
-{      
+{
 /* NSAddImage is also used to get the loaded image, but it only works if the 
lib
    is installed, for uninstalled libs we need to check the install_names 
against
    each other. Note that this is still broken if DYLD_IMAGE_SUFFIX is set and a
@@ -1680,14 +1680,13 @@ static const char* lt_int_dyld_lib_insta
        int j;
        struct load_command *lc;
        unsigned long offset = sizeof(struct mach_header);
-       const struct mach_header *mh1;
        const char* retStr=NULL;
        for (j = 0; j < mh->ncmds; j++)
        {
                lc = (struct load_command*)(((unsigned long)mh) + offset);
                if (LC_ID_DYLIB == lc->cmd)
                {
-                       retStr=(char*)(((struct 
dylib_command*)lc)->dylib.name.offset + 
+                       retStr=(char*)(((struct 
dylib_command*)lc)->dylib.name.offset +
                                                                        
(unsigned long)lc);
                }
                offset += lc->cmdsize;
@@ -1701,7 +1700,7 @@ lt_int_dyld_match_loaded_lib_by_install_
        int i=_dyld_image_count();
        int j;
        const struct mach_header *mh=NULL;
-       const char *id=NULL;    
+       const char *id=NULL;
        for (j = 0; j < i; j++)
        {
                id=lt_int_dyld_lib_install_name(_dyld_get_image_header(j));
@@ -1713,7 +1712,7 @@ lt_int_dyld_match_loaded_lib_by_install_
        }
        return mh;
 }
-       
+
 static NSSymbol
 lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh)
        const char *symbol;
@@ -1732,26 +1731,26 @@ lt_int_dyld_NSlookupSymbolInLinkedLibs(s
                        lc = (struct load_command*)(((unsigned long)mh) + 
offset);
                        if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB 
== lc->cmd))
                        {
-                               
mh1=lt_int_dyld_match_loaded_lib_by_install_name((char*)(((struct 
dylib_command*)lc)->dylib.name.offset + 
+                               
mh1=lt_int_dyld_match_loaded_lib_by_install_name((char*)(((struct 
dylib_command*)lc)->dylib.name.offset +
                                                                                
(unsigned long)lc));
                                if (!mh1)
-                               {       
-                                       /* Maybe NSAddImage can find it */      
                                                                                
        
-                                       mh1=ltdl_NSAddImage((char*)(((struct 
dylib_command*)lc)->dylib.name.offset + 
+                               {
+                                       /* Maybe NSAddImage can find it */
+                                       mh1=ltdl_NSAddImage((char*)(((struct 
dylib_command*)lc)->dylib.name.offset +
                                                                                
(unsigned long)lc),
-                                                                               
NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED + 
+                                                                               
NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED +
                                                                                
NSADDIMAGE_OPTION_WITH_SEARCHING +
                                                                                
NSADDIMAGE_OPTION_RETURN_ON_ERROR );
-                               }                                               
+                               }
                                if (mh1)
                                {
                                        retSym = ltdl_NSLookupSymbolInImage(mh1,
                                                                                
        symbol,
-                                                                               
        NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 
+                                                                               
        NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW
                                                                                
        | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
                                                                                
        );
-                                       if (retSym) break;                      
                        
-                               }                                               
+                                       if (retSym) break;
+                               }
                        }
                        offset += lc->cmdsize;
                }
@@ -1764,7 +1763,7 @@ sys_dyld_init()
 {
        int retCode = 0;
        int err = 0;
-       if (!_dyld_present()) { 
+       if (!_dyld_present()) {
                retCode=1;
        }
        else {
@@ -1784,8 +1783,8 @@ sys_dyld_open (loader_data, filename)
        lt_module   module   = 0;
        NSObjectFileImage ofi = 0;
        NSObjectFileImageReturnCode ofirc;
-       
-       if (!filename) 
+
+       if (!filename)
                return (lt_module)-1;
        ofirc = NSCreateObjectFileImageFromFile(filename, &ofi);
        switch (ofirc)
@@ -1802,9 +1801,9 @@ sys_dyld_open (loader_data, filename)
                case NSObjectFileImageInappropriateFile:
                    if (ltdl_NSIsSymbolNameDefinedInImage && 
ltdl_NSLookupSymbolInImage)
                    {
-                               module = (lt_module)ltdl_NSAddImage(filename, 
NSADDIMAGE_OPTION_RETURN_ON_ERROR);       
+                               module = (lt_module)ltdl_NSAddImage(filename, 
NSADDIMAGE_OPTION_RETURN_ON_ERROR);
                                break;
-                       }       
+                       }
                default:
                        LT_DLMUTEX_SETERROR 
(lt_int_dyld_error(LT_DLSTRERROR(CANNOT_OPEN)));
                        return 0;
@@ -1820,13 +1819,12 @@ sys_dyld_close (loader_data, module)
 {
        int retCode = 0;
        int flags = 0;
-       unsigned long size=0;
        if (module == (lt_module)-1) return 0;
-#ifdef __BIG_ENDIAN__          
+#ifdef __BIG_ENDIAN__
        if (((struct mach_header *)module)->magic == MH_MAGIC)
-#else          
+#else
     if (((struct mach_header *)module)->magic == MH_CIGAM)
-#endif 
+#endif
        {
          LT_DLMUTEX_SETERROR("Can not close a dylib");
          retCode = 1;
@@ -1837,14 +1835,14 @@ sys_dyld_close (loader_data, module)
 /* Currently, if a module contains c++ static destructors and it is unloaded, 
we
    get a segfault in atexit(), due to compiler and dynamic loader differences 
of
    opinion, this works around that.
-*/   
-               if ((const struct section *)NULL != 
+*/
+               if ((const struct section *)NULL !=
                   
getsectbynamefromheader(lt_int_dyld_get_mach_header_from_nsmodule(module),
                   "__DATA","__mod_term_func"))
                {
                        flags += NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED;
-               } 
-#endif         
+               }
+#endif
 #ifdef __ppc__
                        flags += NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
 #endif
@@ -1852,9 +1850,9 @@ sys_dyld_close (loader_data, module)
                {
                        retCode=1;
                        LT_DLMUTEX_SETERROR 
(lt_int_dyld_error(LT_DLSTRERROR(CANNOT_CLOSE)));
-               }                                                               
                
+               }
        }
-       
+
  return retCode;
 }
 
@@ -1873,39 +1871,39 @@ sys_dyld_sym (loader_data, module, symbo
                _dyld_lookup_and_bind(symbol,(unsigned long*)&address,&unused);
                return address;
        }
-#ifdef __BIG_ENDIAN__          
+#ifdef __BIG_ENDIAN__
        if (((struct mach_header *)module)->magic == MH_MAGIC)
-#else          
+#else
     if (((struct mach_header *)module)->magic == MH_CIGAM)
-#endif    
+#endif
        {
            if (ltdl_NSIsSymbolNameDefinedInImage && ltdl_NSLookupSymbolInImage)
            {
                mh=module;
-                       if (ltdl_NSIsSymbolNameDefinedInImage((struct 
mach_header*)module,symbol)) 
+                       if (ltdl_NSIsSymbolNameDefinedInImage((struct 
mach_header*)module,symbol))
                        {
                                nssym = ltdl_NSLookupSymbolInImage((struct 
mach_header*)module,
                                                                                
        symbol,
-                                                                               
        NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 
+                                                                               
        NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW
                                                                                
        | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR
                                                                                
        );
                        }
-           }   
-  
-       }    
+           }
+
+       }
   else {
        nssym = NSLookupSymbolInModule(module, symbol);
        }
-       if (!nssym) 
+       if (!nssym)
        {
                if (!mh) mh=lt_int_dyld_get_mach_header_from_nsmodule(module);
                nssym = lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh);
-       }               
-       if (!nssym) 
+       }
+       if (!nssym)
        {
                LT_DLMUTEX_SETERROR 
(lt_int_dyld_error(LT_DLSTRERROR(SYMBOL_NOT_FOUND)));
                return NULL;
-       }       
+       }
        return NSAddressOfSymbol(nssym);
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]