/[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.9 by gary, Tue Sep 4 00:15:34 2001 UTC revision 1.10 by gary, Thu Sep 20 03:48:05 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    
94    #if WITH_DMALLOC
95    #  include <dmalloc.h>
96    #endif
97    
98    
99    
# Line 163  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA Line 166  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA
166    
167  /* The following macros reduce the amount of typing needed to cast  /* The following macros reduce the amount of typing needed to cast
168     assigned memory.  */     assigned memory.  */
169    #if WITH_DMALLOC
170    
171    #define LT_DLMALLOC(tp, n)      ((tp *) xmalloc ((n) * sizeof(tp)))
172    #define LT_DLREALLOC(tp, p, n)  ((tp *) xrealloc ((p), (n) * sizeof(tp)))
173    #define LT_DLFREE(p)                                            \
174            LT_STMT_START { if (p) (p) = (xfree (p), (lt_ptr) 0); } LT_STMT_END
175    
176    #define LT_EMALLOC(tp, n)       ((tp *) xmalloc ((n) * sizeof(tp)))
177    #define LT_EREALLOC(tp, p, n)   ((tp *) xrealloc ((p), (n) * sizeof(tp)))
178    
179    #else
180    
181  #define LT_DLMALLOC(tp, n)      ((tp *) lt_dlmalloc ((n) * sizeof(tp)))  #define LT_DLMALLOC(tp, n)      ((tp *) lt_dlmalloc ((n) * sizeof(tp)))
182  #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)))
183  #define LT_DLFREE(p)                                            \  #define LT_DLFREE(p)                                            \
# Line 171  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA Line 186  LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PA
186  #define LT_EMALLOC(tp, n)       ((tp *) lt_emalloc ((n) * sizeof(tp)))  #define LT_EMALLOC(tp, n)       ((tp *) lt_emalloc ((n) * sizeof(tp)))
187  #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)))
188    
189    #endif
190    
191  #define LT_DLMEM_REASSIGN(p, q)                 LT_STMT_START { \  #define LT_DLMEM_REASSIGN(p, q)                 LT_STMT_START { \
192          if ((p) != (q)) { lt_dlfree (p); (p) = (q); (q) = 0; }  \          if ((p) != (q)) { if (p) lt_dlfree (p); (p) = (q); (q) = 0; }   \
193                                                  } LT_STMT_END                                                  } LT_STMT_END
194    
195    
# Line 878  char * Line 895  char *
895  lt_estrdup (str)  lt_estrdup (str)
896       const char *str;       const char *str;
897  {  {
898    char *dup = strdup (str);    char *copy = strdup (str);
899    if (LT_STRLEN (str) && !dup)    if (LT_STRLEN (str) && !copy)
900      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
901    return dup;    return copy;
902  }  }
903    
904    
# Line 1682  static int     lt_argz_insert        LT_PARAM Line 1699  static int     lt_argz_insert        LT_PARAM
1699  static  int     lt_argz_insertinorder LT_PARAMS((char **pargz,  static  int     lt_argz_insertinorder LT_PARAMS((char **pargz,
1700                                                   size_t *pargz_len,                                                   size_t *pargz_len,
1701                                                   const char *entry));                                                   const char *entry));
1702    static  int     lt_argz_insertdir     LT_PARAMS((char **pargz,
1703                                                     size_t *pargz_len,
1704                                                     const char *dirnam,
1705                                                     struct dirent *dp));
1706  static  int     lt_dlpath_insertdir   LT_PARAMS((char **ppath,  static  int     lt_dlpath_insertdir   LT_PARAMS((char **ppath,
1707                                                   char *before,                                                   char *before,
1708                                                   const char *dir));                                                   const char *dir));
1709    static  int     list_files_by_dir     LT_PARAMS((const char *dirnam,
1710                                                     char **pargz,
1711                                                     size_t *pargz_len));
1712    static  int     file_not_found        LT_PARAMS((void));
1713    
1714  static  char           *user_search_path= 0;  static  char           *user_search_path= 0;
1715  static  lt_dlloader    *loaders         = 0;  static  lt_dlloader    *loaders         = 0;
# Line 2892  lt_dlopen (filename) Line 2917  lt_dlopen (filename)
2917    
2918  /* If the last error messge store was `FILE_NOT_FOUND', then return  /* If the last error messge store was `FILE_NOT_FOUND', then return
2919     non-zero.  */     non-zero.  */
2920  int  static int
2921  file_not_found ()  file_not_found ()
2922  {  {
2923    const char *error = 0;    const char *error = 0;
# Line 2917  lt_dlopenext (filename) Line 2942  lt_dlopenext (filename)
2942    char *        ext             = 0;    char *        ext             = 0;
2943    int           len;    int           len;
2944    int           errors          = 0;    int           errors          = 0;
   int           file_found      = 1; /* until proven otherwise */  
2945    
2946    if (!filename)    if (!filename)
2947      {      {
# Line 3279  lt_dlclose (handle) Line 3303  lt_dlclose (handle)
3303        errors += handle->loader->module_close (data, handle->module);        errors += handle->loader->module_close (data, handle->module);
3304        errors += unload_deplibs(handle);        errors += unload_deplibs(handle);
3305    
3306          /* It is up to the callers to free the data itself.  */
3307          LT_DLFREE (handle->caller_data);
3308    
3309        LT_DLFREE (handle->info.filename);        LT_DLFREE (handle->info.filename);
3310        LT_DLFREE (handle->info.name);        LT_DLFREE (handle->info.name);
3311        LT_DLFREE (handle);        LT_DLFREE (handle);

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

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