File: libpool.h

package info (click to toggle)
dotconf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 488 kB
  • sloc: ansic: 2,265; makefile: 186; sh: 39
file content (37 lines) | stat: -rw-r--r-- 1,348 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef ST_HAVE_POOL_H
#define ST_HAVE_POOL_H

#ifdef __cplusplus
extern "C" {
#endif

	typedef struct pool pool_t;

/* ------ pool_new - create and return a new pool; make a sub-pool of p if p is non-NULL -------- */
	struct pool *pool_new(struct pool *p);

/* ------ pool_free - destroy a pool and free all memory acquired in this pool and subpools - */
	void pool_free(struct pool *pool);

/* ------ pool_alloc - allocate memory inside of pool ------------------------------------------- */
	void *pool_alloc(struct pool *pool, int size);

/* ------ pool_calloc - allocate memory inside of pool and set to 0 ----------------------------- */
	void *pool_calloc(struct pool *pool, int size);

/* ------ pool_strcat - concatenate the strings in ...; all parts must be char*, last be NULL --- */
	char *pool_strcat(struct pool *pool, ...);

/* ------ pool_strdup - duplicate the string within pool ---------------------------------------- */
	char *pool_strdup(struct pool *pool, const char *str);

/* ------ pool_sprintf - sprintf fmt and ... in pool; currently limited to max length of 8192 --- */
	char *pool_sprintf(struct pool *pool, const char *fmt, ...);

	/* duplicate the first n non-null characters beginning at str */
	char *pool_strndup(struct pool *pool, const char *str, int n);

#ifdef __cplusplus
}				/* extern "C" */
#endif
#endif