integrate dmalloc.h

This commit is contained in:
Doug MacEachern 2005-11-09 18:26:10 +00:00
parent 94d3d82aab
commit 100aed0cb3
3 changed files with 16 additions and 2 deletions

View File

@ -12,6 +12,10 @@
#include <strings.h> #include <strings.h>
#endif #endif
#ifdef DMALLOC
#include <dmalloc.h>
#endif
/* common to all os sigar_t's */ /* common to all os sigar_t's */
/* XXX: this is ugly; but don't want the same stuffs /* XXX: this is ugly; but don't want the same stuffs
* duplicated on 4 platforms and am too lazy to change * duplicated on 4 platforms and am too lazy to change
@ -40,6 +44,15 @@
# define SIGAR_INLINE # define SIGAR_INLINE
#endif #endif
#ifdef DMALLOC
/* linux has its own strdup macro, make sure we use dmalloc's */
#define sigar_strdup(s) \
dmalloc_strdup(__FILE__, __LINE__, s, 0);
#else
#define sigar_strdup(s) \
strdup(s)
#endif
#define SIGAR_ZERO(s) \ #define SIGAR_ZERO(s) \
memset(s, '\0', sizeof(*(s))) memset(s, '\0', sizeof(*(s)))

View File

@ -1021,7 +1021,7 @@ static char *get_fsdev(sigar_t *sigar,
ptr = fsp->dev_name; ptr = fsp->dev_name;
if (strnEQ(ptr, "/dev/", 5)) { if (strnEQ(ptr, "/dev/", 5)) {
ptr += 5; ptr += 5;
ent->value = strdup(ptr); ent->value = sigar_strdup(ptr);
continue; continue;
} }

View File

@ -1347,7 +1347,8 @@ int sigar_net_interface_list_get(sigar_t *sigar,
} }
# endif # endif
#endif #endif
iflist->data[iflist->number++] = strdup(ifr->ifr_name); iflist->data[iflist->number++] =
sigar_strdup(ifr->ifr_name);
} }
return SIGAR_OK; return SIGAR_OK;