Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib/str.h @ 8590:b9faf4db2a9f HEAD
Updated copyright notices to include year 2009.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 06 Jan 2009 09:25:38 -0500 |
parents | c1568782774e |
children |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
4719
diff
changeset
|
1 #ifndef STR_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
4719
diff
changeset
|
2 #define STR_H |
833
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
3 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
4 string_t *str_new(pool_t pool, size_t initial_size); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
5 string_t *t_str_new(size_t initial_size); |
8007 | 6 /* Allocate a constant string using the given str as the input data. |
7 str pointer is saved directly, so it must not be freed until the returned | |
8 string is no longer used. len must contain strlen(str). */ | |
9 string_t *str_new_const(pool_t pool, const char *str, size_t len); | |
8263 | 10 string_t *t_str_new_const(const char *str, size_t len); |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
2839
diff
changeset
|
11 void str_free(string_t **str); |
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
2839
diff
changeset
|
12 char *str_free_without_data(string_t **str); |
833
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
13 |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
14 const char *str_c(string_t *str); |
7912
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
6967
diff
changeset
|
15 const unsigned char *str_data(const string_t *str) ATTR_PURE; |
4451
1a35d53c18fc
Array API redesigned to work using unions. It now provides type safety
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
16 char *str_c_modifiable(string_t *str); |
7912
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
6967
diff
changeset
|
17 size_t str_len(const string_t *str) ATTR_PURE; |
81806d402514
Added more consts, ATTR_CONSTs and ATTR_PUREs.
Timo Sirainen <tss@iki.fi>
parents:
6967
diff
changeset
|
18 bool str_equals(const string_t *str1, const string_t *str2) ATTR_PURE; |
833
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
19 |
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
20 /* Append string/character */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
21 void str_append(string_t *str, const char *cstr); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
22 void str_append_n(string_t *str, const void *cstr, size_t max_len); |
1839
364b1e992154
Use unsigned char for buffer_append_c and str_append_c.
Timo Sirainen <tss@iki.fi>
parents:
995
diff
changeset
|
23 void str_append_c(string_t *str, unsigned char chr); |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
24 void str_append_str(string_t *dest, const string_t *src); |
833
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
25 |
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
26 /* Append printf()-like data */ |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
27 void str_printfa(string_t *str, const char *fmt, ...) |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
28 ATTR_FORMAT(2, 3); |
4719
1995cb3763db
Added sentinel GCC attribute to *_strconcat() functions. Added
Timo Sirainen <tss@iki.fi>
parents:
4451
diff
changeset
|
29 void str_vprintfa(string_t *str, const char *fmt, va_list args) |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6410
diff
changeset
|
30 ATTR_FORMAT(2, 0); |
833
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
31 |
2152 | 32 void str_insert(string_t *str, size_t pos, const char *cstr); |
903
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
33 void str_delete(string_t *str, size_t pos, size_t len); |
fd8888f6f037
Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents:
898
diff
changeset
|
34 void str_truncate(string_t *str, size_t len); |
833
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
35 |
41ec8cadd238
Replaced TempString with a String which can use any memory pool and uses
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
36 #endif |