acl/lib_acl/include/stdlib/acl_dbuf_pool.h

110 lines
3.7 KiB
C
Raw Normal View History

#ifndef ACL_DBUF_POOL_INCLUDE_H
2014-11-19 00:25:21 +08:00
#define ACL_DBUF_POOL_INCLUDE_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ACL_DBUF_POOL ACL_DBUF_POOL;
2015-11-09 22:11:21 +08:00
/**
*
* @param block_size {size_t}
* @return {ACL_DBUF_POOL*} NULL
2015-11-09 22:11:21 +08:00
*/
ACL_API ACL_DBUF_POOL *acl_dbuf_pool_create(size_t block_size);
2015-11-09 22:11:21 +08:00
/**
*
* @param pool {ACL_DBUF_POOL*}
* @param off {size_t}
* @return {int} 0 0
2015-11-09 22:11:21 +08:00
*/
ACL_API int acl_dbuf_pool_reset(ACL_DBUF_POOL *pool, size_t off);
/**
*
* @param pool {ACL_DBUF_POOL*}
2015-11-09 22:11:21 +08:00
*/
2014-11-19 00:25:21 +08:00
ACL_API void acl_dbuf_pool_destroy(ACL_DBUF_POOL *pool);
2015-11-09 22:11:21 +08:00
/**
*
* @param pool {ACL_DBUF_POOL*}
* @param len {size_t}
* @return {void*}
2015-11-09 22:11:21 +08:00
*/
ACL_API void *acl_dbuf_pool_alloc(ACL_DBUF_POOL *pool, size_t len);
/**
*
* @param pool {ACL_DBUF_POOL*}
* @param len {size_t}
* @return {void*}
2015-11-09 22:11:21 +08:00
*/
ACL_API void *acl_dbuf_pool_calloc(ACL_DBUF_POOL *pool, size_t len);
/**
* strdup
* @param pool {ACL_DBUF_POOL*}
* @param s {const char*}
* @return {char*}
2015-11-09 22:11:21 +08:00
*/
2014-11-19 00:25:21 +08:00
ACL_API char *acl_dbuf_pool_strdup(ACL_DBUF_POOL *pool, const char *s);
2015-11-09 22:11:21 +08:00
/**
* strdup
* @param pool {ACL_DBUF_POOL*}
* @param s {const char*}
* @param len {size_t}
* @return {char*}
2015-11-09 22:11:21 +08:00
*/
ACL_API char *acl_dbuf_pool_strndup(ACL_DBUF_POOL *pool,
const char *s, size_t len);
/**
*
* @param pool {ACL_DBUF_POOL*}
* @param addr {const void*}
* @param len {size_t}
* @return {void*}
2015-11-09 22:11:21 +08:00
*/
ACL_API void *acl_dbuf_pool_memdup(ACL_DBUF_POOL *pool,
const void *addr, size_t len);
/**
*
* @param pool {ACL_DBUF_POOL*}
* @param addr {const void*}
* @return {int} -1
* 0
2015-11-09 22:11:21 +08:00
*/
ACL_API int acl_dbuf_pool_free(ACL_DBUF_POOL *pool, const void *addr);
/**
* reset
* @param pool {ACL_DBUF_POOL*}
* @param addr {const void*}
* @return {int} 0 -1
2015-11-09 22:11:21 +08:00
*/
ACL_API int acl_dbuf_pool_keep(ACL_DBUF_POOL *pool, const void *addr);
/**
* 便 dbuf_reset
* @param pool {ACL_DBUF_POOL*}
* @param addr {const void*}
* @return {int} 0 -1
2015-11-09 22:11:21 +08:00
*/
ACL_API int acl_dbuf_pool_unkeep(ACL_DBUF_POOL *pool, const void *addr);
/**
*
2015-11-09 22:11:21 +08:00
*/
2014-11-19 00:25:21 +08:00
ACL_API void acl_dbuf_pool_test(size_t max);
#ifdef __cplusplus
}
#endif
#endif