op_libiberty.c

Go to the documentation of this file.
00001 
00013 #include <string.h>
00014 
00015 #include "op_libiberty.h"
00016 
00017 #ifndef HAVE_XCALLOC
00018 /* some system have a valid libiberty without xcalloc */
00019 void * xcalloc(size_t n_elem, size_t sz)
00020 {
00021     void * ptr = xmalloc(n_elem * sz);
00022 
00023     memset(ptr, '\0', n_elem * sz);
00024 
00025     return ptr;
00026 }
00027 #endif
00028 
00029 #ifndef HAVE_XMEMDUP
00030 void * xmemdup (void const * input, size_t copy_size, size_t alloc_size)
00031 {
00032     void * output = xcalloc(1, alloc_size);
00033 
00034     memcpy(output, input, copy_size);
00035 
00036     return output;
00037 }
00038 #endif

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1