/[libtool]/libtool/libltdl/ltdl.c
ViewVC logotype

Diff of /libtool/libltdl/ltdl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.134.2.6 by gary, Tue Sep 11 03:18:52 2001 UTC revision 1.134.2.7 by gary, Fri Sep 21 17:48:07 2001 UTC
# Line 94  Foundation, Inc., 59 Temple Place, Suite Line 94  Foundation, Inc., 59 Temple Place, Suite
94    
95  #include "ltdl.h"  #include "ltdl.h"
96    
97    #if WITH_DMALLOC
98    #  include <dmalloc.h>
99    #endif
100    
101    
102    
103    
# Line 166  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA Line 170  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA
170    
171  /* The following macros reduce the amount of typing needed to cast  /* The following macros reduce the amount of typing needed to cast
172     assigned memory.  */     assigned memory.  */
173    #if WITH_DMALLOC
174    
175    #define LT_DLMALLOC(tp, n)      ((tp *) xmalloc ((n) * sizeof(tp)))
176    #define LT_DLREALLOC(tp, p, n)  ((tp *) xrealloc ((p), (n) * sizeof(tp)))
177    #define LT_DLFREE(p)                                            \
178            LT_STMT_START { if (p) (p) = (xfree (p), (lt_ptr) 0); } LT_STMT_END
179    
180    #define LT_EMALLOC(tp, n)       ((tp *) xmalloc ((n) * sizeof(tp)))
181    #define LT_EREALLOC(tp, p, n)   ((tp *) xrealloc ((p), (n) * sizeof(tp)))
182    
183    #else
184    
185  #define LT_DLMALLOC(tp, n)      ((tp *) lt_dlmalloc ((n) * sizeof(tp)))  #define LT_DLMALLOC(tp, n)      ((tp *) lt_dlmalloc ((n) * sizeof(tp)))
186  #define LT_DLREALLOC(tp, p, n)  ((tp *) rpl_realloc ((p), (n) * sizeof(tp)))  #define LT_DLREALLOC(tp, p, n)  ((tp *) rpl_realloc ((p), (n) * sizeof(tp)))
187  #define LT_DLFREE(p)                                            \  #define LT_DLFREE(p)                                            \
# Line 174  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA Line 190  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA
190  #define LT_EMALLOC(tp, n)       ((tp *) lt_emalloc ((n) * sizeof(tp)))  #define LT_EMALLOC(tp, n)       ((tp *) lt_emalloc ((n) * sizeof(tp)))
191  #define LT_EREALLOC(tp, p, n)   ((tp *) lt_erealloc ((p), (n) * sizeof(tp)))  #define LT_EREALLOC(tp, p, n)   ((tp *) lt_erealloc ((p), (n) * sizeof(tp)))
192    
193    #endif
194    
195  #define LT_DLMEM_REASSIGN(p, q)                 LT_STMT_START { \  #define LT_DLMEM_REASSIGN(p, q)                 LT_STMT_START { \
196          if ((p) != (q)) { lt_dlfree (p); (p) = (q); (q) = 0; }  \          if ((p) != (q)) { if (p) lt_dlfree (p); (p) = (q); (q) = 0; }   \
197                                                  } LT_STMT_END                                                  } LT_STMT_END
198    
199    
# Line 881  char * Line 899  char *
899  lt_estrdup (str)  lt_estrdup (str)
900       const char *str;       const char *str;
901  {  {
902    char *dup = strdup (str);    char *copy = strdup (str);
903    if (LT_STRLEN (str) && !dup)    if (LT_STRLEN (str) && !copy)
904      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
905    return dup;    return copy;
906  }  }
907    
908    
# Line 1685  static int     lt_argz_insert        LT_PARAM Line 1703  static int     lt_argz_insert        LT_PARAM
1703  static  int     lt_argz_insertinorder LT_PARAMS((char **pargz,  static  int     lt_argz_insertinorder LT_PARAMS((char **pargz,
1704                                                   size_t *pargz_len,                                                   size_t *pargz_len,
1705                                                   const char *entry));                                                   const char *entry));
1706    static  int     lt_argz_insertdir     LT_PARAMS((char **pargz,
1707                                                     size_t *pargz_len,
1708                                                     const char *dirnam,
1709                                                     struct dirent *dp));
1710  static  int     lt_dlpath_insertdir   LT_PARAMS((char **ppath,  static  int     lt_dlpath_insertdir   LT_PARAMS((char **ppath,
1711                                                   char *before,                                                   char *before,
1712                                                   const char *dir));                                                   const char *dir));
1713    static  int     list_files_by_dir     LT_PARAMS((const char *dirnam,
1714                                                     char **pargz,
1715                                                     size_t *pargz_len));
1716    static  int     file_not_found        LT_PARAMS((void));
1717    
1718  static  char           *user_search_path= 0;  static  char           *user_search_path= 0;
1719  static  lt_dlloader    *loaders         = 0;  static  lt_dlloader    *loaders         = 0;
# Line 2139  foreach_dirinpath (search_path, base_nam Line 2165  foreach_dirinpath (search_path, base_nam
2165    int    result         = 0;    int    result         = 0;
2166    int    filenamesize   = 0;    int    filenamesize   = 0;
2167    int    lenbase        = LT_STRLEN (base_name);    int    lenbase        = LT_STRLEN (base_name);
2168    size_t argz_len       = 0;    int   argz_len        = 0;
2169    char * argz           = 0;    char *argz            = 0;
2170    char * filename       = 0;    char *filename        = 0;
2171    char * canonical      = 0;    char *canonical       = 0;
2172    
2173    LT_DLMUTEX_LOCK ();    LT_DLMUTEX_LOCK ();
2174    
# Line 2923  lt_dlopenext (filename) Line 2949  lt_dlopenext (filename)
2949    char *        ext             = 0;    char *        ext             = 0;
2950    int           len;    int           len;
2951    int           errors          = 0;    int           errors          = 0;
   int           file_found      = 1; /* until proven otherwise */  
2952    
2953    if (!filename)    if (!filename)
2954      {      {
# Line 3285  lt_dlclose (handle) Line 3310  lt_dlclose (handle)
3310        errors += handle->loader->module_close (data, handle->module);        errors += handle->loader->module_close (data, handle->module);
3311        errors += unload_deplibs(handle);        errors += unload_deplibs(handle);
3312    
3313          /* It is up to the callers to free the data itself.  */
3314          LT_DLFREE (handle->caller_data);
3315    
3316        LT_DLFREE (handle->info.filename);        LT_DLFREE (handle->info.filename);
3317        LT_DLFREE (handle->info.name);        LT_DLFREE (handle->info.name);
3318        LT_DLFREE (handle);        LT_DLFREE (handle);

Legend:
Removed from v.1.134.2.6  
changed lines
  Added in v.1.134.2.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26