str.c revision 6a9f9a5101b665fd2ef80c9e048a5eace78e01ef
45312f52ff3a3d4c137447be4c7556500c2f8bf2Timo Sirainen/* Copyright (c) 2002-2003 Timo Sirainen */
806cb455553b71934314da98f1b4a694a3aa152eTimo Sirainenstring_t *str_new(pool_t pool, size_t initial_size)
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen return buffer_create_dynamic(pool, initial_size);
806cb455553b71934314da98f1b4a694a3aa152eTimo Sirainen return str_new(pool_datastack_create(), initial_size);
356303df200c991580bd24041996a070ad08c05eTimo Sirainen /* remove the \0 - we don't want to keep it */
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenconst unsigned char *str_data(const string_t *str)
806cb455553b71934314da98f1b4a694a3aa152eTimo Sirainenvoid str_append(string_t *str, const char *cstr)
806cb455553b71934314da98f1b4a694a3aa152eTimo Sirainenvoid str_append_n(string_t *str, const void *cstr, size_t max_len)
806cb455553b71934314da98f1b4a694a3aa152eTimo Sirainen while (len < max_len && ((const char *)cstr)[len] != '\0')
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenvoid str_append_c(string_t *str, unsigned char chr)
22535a9e685e29214082878e37a267157044618eTimo Sirainenvoid str_append_str(string_t *dest, const string_t *src)
22535a9e685e29214082878e37a267157044618eTimo Sirainenvoid str_printfa(string_t *str, const char *fmt, ...)
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainenvoid str_vprintfa(string_t *str, const char *fmt, va_list args)
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen append_len = printf_string_upper_bound(&fmt, args);
25757faf029c369a8318349dafe952e2358df1d8Timo Sirainen buf = buffer_append_space_unsafe(str, append_len);
6fabfb7bbfd88d0c1de66981e52850f26067623bTimo Sirainen i_assert(ret >= 0 && (size_t)ret <= append_len);
806cb455553b71934314da98f1b4a694a3aa152eTimo Sirainenvoid str_insert(string_t *str, size_t pos, const char *cstr)