view src/lib/imem.h @ 91:dc0891523276 HEAD

bugfix for sync fix
author Timo Sirainen <tss@iki.fi>
date Thu, 29 Aug 2002 01:42:00 +0300
parents 1b34ec11fff8
children 4a7ab9e94f25
line wrap: on
line source

#ifndef __IMEM_H
#define __IMEM_H

extern Pool default_pool;

/* For easy allocation of memory from default memory pool. */
#define i_new(type, count) \
        ((type *) i_malloc((unsigned) sizeof(type) * (count)))
void *i_malloc(unsigned int size);
void i_free(void *mem);
void *i_realloc(void *mem, unsigned int size);

/* string functions */
char *i_strdup(const char *str);
char *i_strdup_empty(const char *str); /* like i_strdup(), but if str == "", return NULL */
char *i_strdup_until(const char *str, const char *end); /* *end isn't included */
char *i_strndup(const char *str, unsigned int max_chars);
char *i_strdup_printf(const char *format, ...) __attr_format__(1, 2);
char *i_strdup_vprintf(const char *format, va_list args);
void i_strdup_replace(char **dest, const char *str);

char *i_strconcat(const char *str1, ...); /* NULL terminated */

void imem_init(void);
void imem_deinit(void);

#endif