/[m4]/m4/m4/ltdl.c
ViewVC logotype

Diff of /m4/m4/ltdl.c

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

revision 1.10 by gary, Thu Sep 20 03:48:05 2001 UTC revision 1.11 by gary, Sun Sep 30 14:43:38 2001 UTC
# Line 91  Foundation, Inc., 59 Temple Place, Suite Line 91  Foundation, Inc., 59 Temple Place, Suite
91    
92  #include "ltdl.h"  #include "ltdl.h"
93    
 #if WITH_DMALLOC  
 #  include <dmalloc.h>  
 #endif  
94    
95    
96    
# Line 166  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA Line 163  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA
163    
164  /* The following macros reduce the amount of typing needed to cast  /* The following macros reduce the amount of typing needed to cast
165     assigned memory.  */     assigned memory.  */
 #if WITH_DMALLOC  
   
 #define LT_DLMALLOC(tp, n)      ((tp *) xmalloc ((n) * sizeof(tp)))  
 #define LT_DLREALLOC(tp, p, n)  ((tp *) xrealloc ((p), (n) * sizeof(tp)))  
 #define LT_DLFREE(p)                                            \  
         LT_STMT_START { if (p) (p) = (xfree (p), (lt_ptr) 0); } LT_STMT_END  
   
 #define LT_EMALLOC(tp, n)       ((tp *) xmalloc ((n) * sizeof(tp)))  
 #define LT_EREALLOC(tp, p, n)   ((tp *) xrealloc ((p), (n) * sizeof(tp)))  
   
 #else  
   
166  #define LT_DLMALLOC(tp, n)      ((tp *) lt_dlmalloc ((n) * sizeof(tp)))  #define LT_DLMALLOC(tp, n)      ((tp *) lt_dlmalloc ((n) * sizeof(tp)))
167  #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)))
168  #define LT_DLFREE(p)                                            \  #define LT_DLFREE(p)                                            \
# Line 186  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA Line 171  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA
171  #define LT_EMALLOC(tp, n)       ((tp *) lt_emalloc ((n) * sizeof(tp)))  #define LT_EMALLOC(tp, n)       ((tp *) lt_emalloc ((n) * sizeof(tp)))
172  #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)))
173    
 #endif  
   
174  #define LT_DLMEM_REASSIGN(p, q)                 LT_STMT_START { \  #define LT_DLMEM_REASSIGN(p, q)                 LT_STMT_START { \
175          if ((p) != (q)) { if (p) lt_dlfree (p); (p) = (q); (q) = 0; }   \          if ((p) != (q)) { lt_dlfree (p); (p) = (q); (q) = 0; }  \
176                                                  } LT_STMT_END                                                  } LT_STMT_END
177    
178    
# Line 895  char * Line 878  char *
878  lt_estrdup (str)  lt_estrdup (str)
879       const char *str;       const char *str;
880  {  {
881    char *copy = strdup (str);    char *dup = strdup (str);
882    if (LT_STRLEN (str) && !copy)    if (LT_STRLEN (str) && !dup)
883      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
884    return copy;    return dup;
885  }  }
886    
887    
# Line 1699  static int     lt_argz_insert        LT_PARAM Line 1682  static int     lt_argz_insert        LT_PARAM
1682  static  int     lt_argz_insertinorder LT_PARAMS((char **pargz,  static  int     lt_argz_insertinorder LT_PARAMS((char **pargz,
1683                                                   size_t *pargz_len,                                                   size_t *pargz_len,
1684                                                   const char *entry));                                                   const char *entry));
 static  int     lt_argz_insertdir     LT_PARAMS((char **pargz,  
                                                  size_t *pargz_len,  
                                                  const char *dirnam,  
                                                  struct dirent *dp));  
1685  static  int     lt_dlpath_insertdir   LT_PARAMS((char **ppath,  static  int     lt_dlpath_insertdir   LT_PARAMS((char **ppath,
1686                                                   char *before,                                                   char *before,
1687                                                   const char *dir));                                                   const char *dir));
 static  int     list_files_by_dir     LT_PARAMS((const char *dirnam,  
                                                  char **pargz,  
                                                  size_t *pargz_len));  
 static  int     file_not_found        LT_PARAMS((void));  
1688    
1689  static  char           *user_search_path= 0;  static  char           *user_search_path= 0;
1690  static  lt_dlloader    *loaders         = 0;  static  lt_dlloader    *loaders         = 0;
# Line 2917  lt_dlopen (filename) Line 2892  lt_dlopen (filename)
2892    
2893  /* If the last error messge store was `FILE_NOT_FOUND', then return  /* If the last error messge store was `FILE_NOT_FOUND', then return
2894     non-zero.  */     non-zero.  */
2895  static int  int
2896  file_not_found ()  file_not_found ()
2897  {  {
2898    const char *error = 0;    const char *error = 0;
# Line 2942  lt_dlopenext (filename) Line 2917  lt_dlopenext (filename)
2917    char *        ext             = 0;    char *        ext             = 0;
2918    int           len;    int           len;
2919    int           errors          = 0;    int           errors          = 0;
2920      int           file_found      = 1; /* until proven otherwise */
2921    
2922    if (!filename)    if (!filename)
2923      {      {
# Line 3303  lt_dlclose (handle) Line 3279  lt_dlclose (handle)
3279        errors += handle->loader->module_close (data, handle->module);        errors += handle->loader->module_close (data, handle->module);
3280        errors += unload_deplibs(handle);        errors += unload_deplibs(handle);
3281    
       /* It is up to the callers to free the data itself.  */  
       LT_DLFREE (handle->caller_data);  
   
3282        LT_DLFREE (handle->info.filename);        LT_DLFREE (handle->info.filename);
3283        LT_DLFREE (handle->info.name);        LT_DLFREE (handle->info.name);
3284        LT_DLFREE (handle);        LT_DLFREE (handle);

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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