An extensible data structure for massive streaming graphs
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
xmalloc.h File Reference
#include <stdlib.h>
#include <sys/mman.h>

Macros

#define FNATTR_MALLOC
#define xfree(p)
 Self-checking wrapper to free()

Functions

void * xmalloc (size_t) FNATTR_MALLOC
 Self-checking wrapper to malloc()
void * xcalloc (size_t, size_t) FNATTR_MALLOC
 Self-checking wrapper to calloc()
void * xrealloc (void *, size_t) FNATTR_MALLOC
 Self-checking wrapper to realloc()
void * xmmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
 Self-checking wrapper to mmap()
void xelemset (int64_t *s, int64_t c, int64_t n)
 Initialize all elements of an array.
void xelemcpy (int64_t *dest, int64_t *src, int64_t n)
 Copy from one array to another.
void xzero (void *x, const size_t sz)
 Write zeros to sz bytes starting at x.

Macro Definition Documentation

#define FNATTR_MALLOC
#define xfree (   p)
Value:
{ \
if (p != NULL) { \
free(p); \
p = NULL; \
} \
}

Self-checking wrapper to free()

Parameters
pPointer to allocation

Function Documentation

void* xcalloc ( size_t  nelem,
size_t  sz 
)

Self-checking wrapper to calloc()

Parameters
nelemNumber of elements
szSize of each element
Returns

Referenced by stinger_new(), stinger_open_from_file(), stinger_save_to_file(), stinger_set_initial_edges(), and stinger_to_unsorted_csr().

void xelemcpy ( int64_t *  dest,
int64_t *  src,
int64_t  num 
)

Copy from one array to another.

Parameters
destOutput array
srcInput array
numNumber of elements to copy

Referenced by stinger_iterator_edge_type_filter(), stinger_iterator_vertex_filter(), and stinger_iterator_vertex_type_filter().

void xelemset ( int64_t *  s,
int64_t  c,
int64_t  num 
)

Initialize all elements of an array.

Parameters
sArray to initialize
cValue to set
numNumber of elements in the array
void* xmmap ( void *  addr,
size_t  len,
int  prot,
int  flags,
int  fd,
off_t  offset 
)

Self-checking wrapper to mmap()

Parameters
addrStarting address for new mapping
lenLength of the mapping
protMemory protection of the mapping
flagsMAP_SHARED or MAP_PRIVATE, plus other flags
fdFile descriptor
offsetOffset
Returns
void* xrealloc ( void *  p,
size_t  sz 
)

Self-checking wrapper to realloc()

Parameters
pPointer to current allocation
szNumber of bytes of new allocation
Returns
void xzero ( void *  x,
const size_t  sz 
)

Write zeros to sz bytes starting at x.

Parameters
xPointer to memory location
szMemory size in bytes

References MTASTREAMS.

Referenced by new_ebs().

 

comments powered by Disqus