ossp-pkg/act/act_mem.h
1.3
/* ====================================================================
* Copyright (c) 1999-2000 Ralf S. Engelschall. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY RALF S. ENGELSCHALL ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RALF S. ENGELSCHALL OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
/*
** act_mem.h -- Memory Handling
*/
#ifndef _ACT_MEM_H_
#define _ACT_MEM_H_
extern void *(*act_mem_alloc)(size_t);
extern void *(*act_mem_realloc)(void *, size_t);
extern void (*act_mem_free)(void *);
extern void *(*act_mem_dup)(void *, size_t);
extern void *(*act_mem_set)(void *, int, size_t);
extern void *(*act_mem_move)(void *, const void *, size_t);
extern void *(*act_mem_char)(const void *, unsigned char, size_t);
extern void *(*act_mem_mem)(const void *, size_t, const void *, size_t);
extern int (*act_mem_cmp)(const void *, const void *, size_t);
extern void *act_mem_alloc_ctx(act_ctx_t *, size_t);
extern void *act_mem_realloc_ctx(act_ctx_t *, void *, size_t);
extern void act_mem_free_ctx(act_ctx_t *, void *);
typedef void *(*act_mem_alloc_t)(size_t);
typedef void *(*act_mem_realloc_t)(void *, size_t);
typedef void (*act_mem_free_t)(void *);
typedef void *(*act_mem_alloc_ctx_t)(void *, size_t);
typedef void *(*act_mem_realloc_ctx_t)(void *, void *, size_t);
typedef void (*act_mem_free_ctx_t)(void *, void *);
#define ACT_CTX_MEM_ALLOC ACT_CTX_ID(ptr,MEM,0)
#define ACT_CTX_MEM_REALLOC ACT_CTX_ID(ptr,MEM,1)
#define ACT_CTX_MEM_FREE ACT_CTX_ID(ptr,MEM,2)
#define ACT_CTX_MEM_CTXARG ACT_CTX_ID(ptr,MEM,3)
#define ACT_CTX_MEM_CTXUSE ACT_CTX_ID(int,MEM,4)
#endif /* _ACT_MEM_H_ */