/src/irssi/subprojects/glib-2.74.3/glib/gstring.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* GLIB - Library of useful routines for C programming |
2 | | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
3 | | * |
4 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
5 | | * |
6 | | * This library is free software; you can redistribute it and/or |
7 | | * modify it under the terms of the GNU Lesser General Public |
8 | | * License as published by the Free Software Foundation; either |
9 | | * version 2.1 of the License, or (at your option) any later version. |
10 | | * |
11 | | * This library is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | | * Lesser General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU Lesser General Public |
17 | | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
18 | | */ |
19 | | |
20 | | /* |
21 | | * Modified by the GLib Team and others 1997-2000. See the AUTHORS |
22 | | * file for a list of people on the GLib Team. See the ChangeLog |
23 | | * files for a list of changes. These files are distributed with |
24 | | * GLib at ftp://ftp.gtk.org/pub/gtk/. |
25 | | */ |
26 | | |
27 | | #ifndef __G_STRING_H__ |
28 | | #define __G_STRING_H__ |
29 | | |
30 | | #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION) |
31 | | #error "Only <glib.h> can be included directly." |
32 | | #endif |
33 | | |
34 | | #include <glib/gtypes.h> |
35 | | #include <glib/gunicode.h> |
36 | | #include <glib/gbytes.h> |
37 | | #include <glib/gutils.h> /* for G_CAN_INLINE */ |
38 | | |
39 | | G_BEGIN_DECLS |
40 | | |
41 | | typedef struct _GString GString; |
42 | | |
43 | | struct _GString |
44 | | { |
45 | | gchar *str; |
46 | | gsize len; |
47 | | gsize allocated_len; |
48 | | }; |
49 | | |
50 | | GLIB_AVAILABLE_IN_ALL |
51 | | GString* g_string_new (const gchar *init); |
52 | | GLIB_AVAILABLE_IN_ALL |
53 | | GString* g_string_new_len (const gchar *init, |
54 | | gssize len); |
55 | | GLIB_AVAILABLE_IN_ALL |
56 | | GString* g_string_sized_new (gsize dfl_size); |
57 | | GLIB_AVAILABLE_IN_ALL |
58 | | gchar* g_string_free (GString *string, |
59 | | gboolean free_segment); |
60 | | GLIB_AVAILABLE_IN_2_34 |
61 | | GBytes* g_string_free_to_bytes (GString *string); |
62 | | GLIB_AVAILABLE_IN_ALL |
63 | | gboolean g_string_equal (const GString *v, |
64 | | const GString *v2); |
65 | | GLIB_AVAILABLE_IN_ALL |
66 | | guint g_string_hash (const GString *str); |
67 | | GLIB_AVAILABLE_IN_ALL |
68 | | GString* g_string_assign (GString *string, |
69 | | const gchar *rval); |
70 | | GLIB_AVAILABLE_IN_ALL |
71 | | GString* g_string_truncate (GString *string, |
72 | | gsize len); |
73 | | GLIB_AVAILABLE_IN_ALL |
74 | | GString* g_string_set_size (GString *string, |
75 | | gsize len); |
76 | | GLIB_AVAILABLE_IN_ALL |
77 | | GString* g_string_insert_len (GString *string, |
78 | | gssize pos, |
79 | | const gchar *val, |
80 | | gssize len); |
81 | | GLIB_AVAILABLE_IN_ALL |
82 | | GString* g_string_append (GString *string, |
83 | | const gchar *val); |
84 | | GLIB_AVAILABLE_IN_ALL |
85 | | GString* g_string_append_len (GString *string, |
86 | | const gchar *val, |
87 | | gssize len); |
88 | | GLIB_AVAILABLE_IN_ALL |
89 | | GString* g_string_append_c (GString *string, |
90 | | gchar c); |
91 | | GLIB_AVAILABLE_IN_ALL |
92 | | GString* g_string_append_unichar (GString *string, |
93 | | gunichar wc); |
94 | | GLIB_AVAILABLE_IN_ALL |
95 | | GString* g_string_prepend (GString *string, |
96 | | const gchar *val); |
97 | | GLIB_AVAILABLE_IN_ALL |
98 | | GString* g_string_prepend_c (GString *string, |
99 | | gchar c); |
100 | | GLIB_AVAILABLE_IN_ALL |
101 | | GString* g_string_prepend_unichar (GString *string, |
102 | | gunichar wc); |
103 | | GLIB_AVAILABLE_IN_ALL |
104 | | GString* g_string_prepend_len (GString *string, |
105 | | const gchar *val, |
106 | | gssize len); |
107 | | GLIB_AVAILABLE_IN_ALL |
108 | | GString* g_string_insert (GString *string, |
109 | | gssize pos, |
110 | | const gchar *val); |
111 | | GLIB_AVAILABLE_IN_ALL |
112 | | GString* g_string_insert_c (GString *string, |
113 | | gssize pos, |
114 | | gchar c); |
115 | | GLIB_AVAILABLE_IN_ALL |
116 | | GString* g_string_insert_unichar (GString *string, |
117 | | gssize pos, |
118 | | gunichar wc); |
119 | | GLIB_AVAILABLE_IN_ALL |
120 | | GString* g_string_overwrite (GString *string, |
121 | | gsize pos, |
122 | | const gchar *val); |
123 | | GLIB_AVAILABLE_IN_ALL |
124 | | GString* g_string_overwrite_len (GString *string, |
125 | | gsize pos, |
126 | | const gchar *val, |
127 | | gssize len); |
128 | | GLIB_AVAILABLE_IN_ALL |
129 | | GString* g_string_erase (GString *string, |
130 | | gssize pos, |
131 | | gssize len); |
132 | | GLIB_AVAILABLE_IN_2_68 |
133 | | guint g_string_replace (GString *string, |
134 | | const gchar *find, |
135 | | const gchar *replace, |
136 | | guint limit); |
137 | | GLIB_AVAILABLE_IN_ALL |
138 | | GString* g_string_ascii_down (GString *string); |
139 | | GLIB_AVAILABLE_IN_ALL |
140 | | GString* g_string_ascii_up (GString *string); |
141 | | GLIB_AVAILABLE_IN_ALL |
142 | | void g_string_vprintf (GString *string, |
143 | | const gchar *format, |
144 | | va_list args) |
145 | | G_GNUC_PRINTF(2, 0); |
146 | | GLIB_AVAILABLE_IN_ALL |
147 | | void g_string_printf (GString *string, |
148 | | const gchar *format, |
149 | | ...) G_GNUC_PRINTF (2, 3); |
150 | | GLIB_AVAILABLE_IN_ALL |
151 | | void g_string_append_vprintf (GString *string, |
152 | | const gchar *format, |
153 | | va_list args) |
154 | | G_GNUC_PRINTF(2, 0); |
155 | | GLIB_AVAILABLE_IN_ALL |
156 | | void g_string_append_printf (GString *string, |
157 | | const gchar *format, |
158 | | ...) G_GNUC_PRINTF (2, 3); |
159 | | GLIB_AVAILABLE_IN_ALL |
160 | | GString* g_string_append_uri_escaped (GString *string, |
161 | | const gchar *unescaped, |
162 | | const gchar *reserved_chars_allowed, |
163 | | gboolean allow_utf8); |
164 | | |
165 | | /* -- optimize g_strig_append_c --- */ |
166 | | #ifdef G_CAN_INLINE |
167 | | static inline GString* |
168 | | g_string_append_c_inline (GString *gstring, |
169 | | gchar c) |
170 | 31.4M | { |
171 | 31.4M | if (gstring->len + 1 < gstring->allocated_len) |
172 | 31.4M | { |
173 | 31.4M | gstring->str[gstring->len++] = c; |
174 | 31.4M | gstring->str[gstring->len] = 0; |
175 | 31.4M | } |
176 | 7.05k | else |
177 | 7.05k | g_string_insert_c (gstring, -1, c); |
178 | 31.4M | return gstring; |
179 | 31.4M | } Unexecuted instantiation: gcharset.c:g_string_append_c_inline Unexecuted instantiation: gconvert.c:g_string_append_c_inline Unexecuted instantiation: gdatetime.c:g_string_append_c_inline Unexecuted instantiation: genviron.c:g_string_append_c_inline Unexecuted instantiation: gerror.c:g_string_append_c_inline Unexecuted instantiation: gfileutils.c:g_string_append_c_inline Unexecuted instantiation: ggettext.c:g_string_append_c_inline Unexecuted instantiation: ghash.c:g_string_append_c_inline Unexecuted instantiation: giochannel.c:g_string_append_c_inline Unexecuted instantiation: glist.c:g_string_append_c_inline Unexecuted instantiation: gmain.c:g_string_append_c_inline Unexecuted instantiation: gmem.c:g_string_append_c_inline Unexecuted instantiation: gmessages.c:g_string_append_c_inline Unexecuted instantiation: goption.c:g_string_append_c_inline Unexecuted instantiation: gpattern.c:g_string_append_c_inline Unexecuted instantiation: gpoll.c:g_string_append_c_inline Unexecuted instantiation: gquark.c:g_string_append_c_inline Unexecuted instantiation: gqueue.c:g_string_append_c_inline Unexecuted instantiation: grefcount.c:g_string_append_c_inline Unexecuted instantiation: grefstring.c:g_string_append_c_inline Unexecuted instantiation: gregex.c:g_string_append_c_inline Unexecuted instantiation: gsequence.c:g_string_append_c_inline Unexecuted instantiation: gslice.c:g_string_append_c_inline Unexecuted instantiation: gslist.c:g_string_append_c_inline Unexecuted instantiation: gstdio.c:g_string_append_c_inline Unexecuted instantiation: gstrfuncs.c:g_string_append_c_inline Unexecuted instantiation: gstring.c:g_string_append_c_inline Unexecuted instantiation: gtestutils.c:g_string_append_c_inline Unexecuted instantiation: gtimer.c:g_string_append_c_inline Unexecuted instantiation: gtimezone.c:g_string_append_c_inline Unexecuted instantiation: gtranslit.c:g_string_append_c_inline Unexecuted instantiation: gtree.c:g_string_append_c_inline Unexecuted instantiation: guniprop.c:g_string_append_c_inline Unexecuted instantiation: gutf8.c:g_string_append_c_inline Unexecuted instantiation: guri.c:g_string_append_c_inline Unexecuted instantiation: gutils.c:g_string_append_c_inline Unexecuted instantiation: gvariant.c:g_string_append_c_inline Unexecuted instantiation: gvariant-core.c:g_string_append_c_inline Unexecuted instantiation: gvariant-serialiser.c:g_string_append_c_inline Unexecuted instantiation: gvarianttypeinfo.c:g_string_append_c_inline Unexecuted instantiation: gvarianttype.c:g_string_append_c_inline Unexecuted instantiation: gwakeup.c:g_string_append_c_inline Unexecuted instantiation: gprintf.c:g_string_append_c_inline Unexecuted instantiation: glib-unix.c:g_string_append_c_inline Unexecuted instantiation: gspawn.c:g_string_append_c_inline Unexecuted instantiation: giounix.c:g_string_append_c_inline Unexecuted instantiation: gthread-posix.c:g_string_append_c_inline Unexecuted instantiation: garcbox.c:g_string_append_c_inline Unexecuted instantiation: garray.c:g_string_append_c_inline Unexecuted instantiation: gbitlock.c:g_string_append_c_inline Unexecuted instantiation: gbytes.c:g_string_append_c_inline Unexecuted instantiation: gdate.c:g_string_append_c_inline Unexecuted instantiation: gdir.c:g_string_append_c_inline Unexecuted instantiation: ghostutils.c:g_string_append_c_inline Unexecuted instantiation: glib-init.c:g_string_append_c_inline Unexecuted instantiation: gmappedfile.c:g_string_append_c_inline Unexecuted instantiation: gqsort.c:g_string_append_c_inline Unexecuted instantiation: grand.c:g_string_append_c_inline Unexecuted instantiation: grcbox.c:g_string_append_c_inline Unexecuted instantiation: gshell.c:g_string_append_c_inline gscanner.c:g_string_append_c_inline Line | Count | Source | 170 | 31.4M | { | 171 | 31.4M | if (gstring->len + 1 < gstring->allocated_len) | 172 | 31.4M | { | 173 | 31.4M | gstring->str[gstring->len++] = c; | 174 | 31.4M | gstring->str[gstring->len] = 0; | 175 | 31.4M | } | 176 | 7.05k | else | 177 | 7.05k | g_string_insert_c (gstring, -1, c); | 178 | 31.4M | return gstring; | 179 | 31.4M | } |
Unexecuted instantiation: gdataset.c:g_string_append_c_inline Unexecuted instantiation: gmodule.c:g_string_append_c_inline Unexecuted instantiation: gbase64.c:g_string_append_c_inline |
180 | 31.4M | #define g_string_append_c(gstr,c) g_string_append_c_inline (gstr, c) |
181 | | #endif /* G_CAN_INLINE */ |
182 | | |
183 | | |
184 | | GLIB_DEPRECATED |
185 | | GString *g_string_down (GString *string); |
186 | | GLIB_DEPRECATED |
187 | | GString *g_string_up (GString *string); |
188 | | |
189 | | #define g_string_sprintf g_string_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_printf) |
190 | | #define g_string_sprintfa g_string_append_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_append_printf) |
191 | | |
192 | | G_END_DECLS |
193 | | |
194 | | #endif /* __G_STRING_H__ */ |