/*
 * frostmem.h
 *
 *  Created on: Jun 29, 2012
 *      Author: ergino
 */

#ifndef FROSTMEM_H_
#define FROSTMEM_H_

#include "frost_common.h"

#ifdef __cplusplus
extern "C"
{
#endif

void  frost_free (void *ptr);
void* frost_memdup (const void * mem, unsigned int byte_size);
void* frost_realloc (void* obj, unsigned long size);
void* frost_malloc (unsigned long x);
void* frost_calloc (unsigned long x);
void* frost_try_malloc (unsigned long x);
void* frost_try_realloc (void* obj, unsigned long size);
#define frost_memmove(dest,src,len) memmove (dest, src, len)
#define frost_renew(struct_type, mem, n_structs) frost_realloc (mem, sizeof (struct_type) * n_structs)

frost_pointer frost_memdup (frost_constpointer mem, frost_uint byte_size);
inline char   *frost_strdup (const char *str) { if (str) {return strdup (str);} return NULL; }
char **frost_strdupv (char **str_array);

#ifdef __cplusplus
}
#endif

#endif /* FROSTMEM_H_ */
