1 : /* Copyright (c) 2007 James Antill -- See LICENSE file for terms. */
2 : #ifndef USTR_SET_H
3 : #define USTR_SET_H 1
4 :
5 : #ifndef USTR_MAIN_H
6 : #error " You should have already included ustr-main.h, or just include ustr.h."
7 : #endif
8 :
9 : #define USTR_SET_OBJ(x, y) ustr_set_buf(x, y, sizeof(y))
10 : #define USTR_SET_OSTR(x, y) ustr_set_buf(x, y, sizeof(y) - 1)
11 :
12 : #define USTRP_SET_OBJ(p, x, y) ustrp_set_buf(p, x, y, sizeof(y))
13 : #define USTRP_SET_OSTR(p, x, y) ustrp_set_buf(p, x, y, sizeof(y) - 1)
14 :
15 : USTR_CONF_E_PROTO int ustr_set_undef(struct Ustr **, size_t)
16 : USTR__COMPILE_ATTR_NONNULL_A();
17 : USTR_CONF_E_PROTO int ustr_set_empty(struct Ustr **)
18 : USTR__COMPILE_ATTR_NONNULL_A();
19 : USTR_CONF_E_PROTO int ustr_set_buf(struct Ustr **, const void *, size_t)
20 : USTR__COMPILE_ATTR_NONNULL_A();
21 : USTR_CONF_EI_PROTO int ustr_set_cstr(struct Ustr **, const char *)
22 : USTR__COMPILE_ATTR_NONNULL_A();
23 : USTR_CONF_E_PROTO int ustr_set(struct Ustr **, const struct Ustr *)
24 : USTR__COMPILE_ATTR_NONNULL_A();
25 : USTR_CONF_E_PROTO
26 : int ustr_set_subustr(struct Ustr **, const struct Ustr *, size_t, size_t)
27 : USTR__COMPILE_ATTR_NONNULL_A();
28 : USTR_CONF_E_PROTO int ustr_set_rep_chr(struct Ustr **, char, size_t)
29 : USTR__COMPILE_ATTR_NONNULL_A();
30 :
31 : USTR_CONF_E_PROTO
32 : int ustrp_set_undef(struct Ustr_pool *, struct Ustrp **, size_t)
33 : USTR__COMPILE_ATTR_NONNULL_L((2));
34 : USTR_CONF_E_PROTO int ustrp_set_empty(struct Ustr_pool *, struct Ustrp **)
35 : USTR__COMPILE_ATTR_NONNULL_L((2));
36 : USTR_CONF_E_PROTO
37 : int ustrp_set_buf(struct Ustr_pool *, struct Ustrp **,const void *,size_t)
38 : USTR__COMPILE_ATTR_NONNULL_L((2, 3));
39 : USTR_CONF_EI_PROTO
40 : int ustrp_set_cstr(struct Ustr_pool *, struct Ustrp **, const char *)
41 : USTR__COMPILE_ATTR_NONNULL_L((2, 3));
42 : USTR_CONF_E_PROTO
43 : int ustrp_set(struct Ustr_pool *, struct Ustrp **, const struct Ustrp *)
44 : USTR__COMPILE_ATTR_NONNULL_L((2, 3));
45 : USTR_CONF_E_PROTO
46 : int ustrp_set_subustrp(struct Ustr_pool *, struct Ustrp **,
47 : const struct Ustrp *, size_t, size_t)
48 : USTR__COMPILE_ATTR_NONNULL_L((2, 3));
49 : USTR_CONF_E_PROTO
50 : int ustrp_set_rep_chr(struct Ustr_pool *, struct Ustrp **, char, size_t)
51 : USTR__COMPILE_ATTR_NONNULL_L((2));
52 :
53 : #ifdef USTR_FMT_H
54 : # if USTR_CONF_HAVE_VA_COPY
55 : USTR_CONF_E_PROTO
56 : int ustr_set_vfmt_lim(struct Ustr **, size_t, const char *, va_list)
57 : USTR__COMPILE_ATTR_NONNULL_L((1, 3)) USTR__COMPILE_ATTR_FMT(3, 0);
58 : USTR_CONF_E_PROTO int ustr_set_vfmt(struct Ustr **, const char *, va_list)
59 : USTR__COMPILE_ATTR_NONNULL_L((1, 2)) USTR__COMPILE_ATTR_FMT(2, 0);
60 :
61 : USTR_CONF_E_PROTO
62 : int ustrp_set_vfmt_lim(struct Ustr_pool *, struct Ustrp **, size_t,
63 : const char *, va_list)
64 : USTR__COMPILE_ATTR_NONNULL_L((2, 4)) USTR__COMPILE_ATTR_FMT(4, 0);
65 : USTR_CONF_E_PROTO
66 : int ustrp_set_vfmt(struct Ustr_pool *, struct Ustrp **, const char *, va_list)
67 : USTR__COMPILE_ATTR_NONNULL_L((2, 3)) USTR__COMPILE_ATTR_FMT(3, 0);
68 : # endif
69 :
70 : USTR_CONF_E_PROTO int ustr_set_fmt_lim(struct Ustr **, size_t,const char *, ...)
71 : USTR__COMPILE_ATTR_NONNULL_L((1, 3)) USTR__COMPILE_ATTR_FMT(3, 4);
72 : USTR_CONF_E_PROTO int ustr_set_fmt(struct Ustr **, const char *, ...)
73 : USTR__COMPILE_ATTR_NONNULL_L((1, 2)) USTR__COMPILE_ATTR_FMT(2, 3);
74 :
75 : USTR_CONF_E_PROTO
76 : int ustrp_set_fmt_lim(struct Ustr_pool *, struct Ustrp **, size_t,
77 : const char *, ...)
78 : USTR__COMPILE_ATTR_NONNULL_L((2, 4)) USTR__COMPILE_ATTR_FMT(4, 5);
79 : USTR_CONF_E_PROTO
80 : int ustrp_set_fmt(struct Ustr_pool *, struct Ustrp **, const char *, ...)
81 : USTR__COMPILE_ATTR_NONNULL_L((2, 3)) USTR__COMPILE_ATTR_FMT(3, 4);
82 : #endif
83 :
84 : #if USTR_CONF_INCLUDE_INTERNAL_HEADERS
85 : # include "ustr-set-internal.h"
86 : #endif
87 :
88 : #if USTR_CONF_INCLUDE_CODEONLY_HEADERS
89 : # include "ustr-set-code.h"
90 : #endif
91 :
92 : #if USTR_CONF_COMPILE_USE_INLINE
93 : USTR_CONF_II_PROTO int ustr_set_cstr(struct Ustr **ps1, const char *cstr)
94 108 : { return (ustr_set_buf(ps1, cstr, strlen(cstr))); }
95 :
96 : USTR_CONF_II_PROTO
97 : int ustrp_set_cstr(struct Ustr_pool *p, struct Ustrp **ps1, const char *cstr)
98 10 : { return (ustrp_set_buf(p, ps1, cstr, strlen(cstr))); }
99 : #endif
100 :
101 : #endif
|