Coverage Report

Created: 2025-06-24 06:17

/usr/include/glib-2.0/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
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2.1 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16
 */
17
18
/*
19
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
20
 * file for a list of people on the GLib Team.  See the ChangeLog
21
 * files for a list of changes.  These files are distributed with
22
 * GLib at ftp://ftp.gtk.org/pub/gtk/.
23
 */
24
25
#ifndef __G_STRING_H__
26
#define __G_STRING_H__
27
28
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
29
#error "Only <glib.h> can be included directly."
30
#endif
31
32
#include <glib/gtypes.h>
33
#include <glib/gunicode.h>
34
#include <glib/gbytes.h>
35
#include <glib/gutils.h>  /* for G_CAN_INLINE */
36
37
G_BEGIN_DECLS
38
39
typedef struct _GString         GString;
40
41
struct _GString
42
{
43
  gchar  *str;
44
  gsize len;
45
  gsize allocated_len;
46
};
47
48
GLIB_AVAILABLE_IN_ALL
49
GString*     g_string_new               (const gchar     *init);
50
GLIB_AVAILABLE_IN_ALL
51
GString*     g_string_new_len           (const gchar     *init,
52
                                         gssize           len);
53
GLIB_AVAILABLE_IN_ALL
54
GString*     g_string_sized_new         (gsize            dfl_size);
55
GLIB_AVAILABLE_IN_ALL
56
gchar*       g_string_free              (GString         *string,
57
                                         gboolean         free_segment);
58
GLIB_AVAILABLE_IN_2_34
59
GBytes*      g_string_free_to_bytes     (GString         *string);
60
GLIB_AVAILABLE_IN_ALL
61
gboolean     g_string_equal             (const GString   *v,
62
                                         const GString   *v2);
63
GLIB_AVAILABLE_IN_ALL
64
guint        g_string_hash              (const GString   *str);
65
GLIB_AVAILABLE_IN_ALL
66
GString*     g_string_assign            (GString         *string,
67
                                         const gchar     *rval);
68
GLIB_AVAILABLE_IN_ALL
69
GString*     g_string_truncate          (GString         *string,
70
                                         gsize            len);
71
GLIB_AVAILABLE_IN_ALL
72
GString*     g_string_set_size          (GString         *string,
73
                                         gsize            len);
74
GLIB_AVAILABLE_IN_ALL
75
GString*     g_string_insert_len        (GString         *string,
76
                                         gssize           pos,
77
                                         const gchar     *val,
78
                                         gssize           len);
79
GLIB_AVAILABLE_IN_ALL
80
GString*     g_string_append            (GString         *string,
81
                                         const gchar     *val);
82
GLIB_AVAILABLE_IN_ALL
83
GString*     g_string_append_len        (GString         *string,
84
                                         const gchar     *val,
85
                                         gssize           len);
86
GLIB_AVAILABLE_IN_ALL
87
GString*     g_string_append_c          (GString         *string,
88
                                         gchar            c);
89
GLIB_AVAILABLE_IN_ALL
90
GString*     g_string_append_unichar    (GString         *string,
91
                                         gunichar         wc);
92
GLIB_AVAILABLE_IN_ALL
93
GString*     g_string_prepend           (GString         *string,
94
                                         const gchar     *val);
95
GLIB_AVAILABLE_IN_ALL
96
GString*     g_string_prepend_c         (GString         *string,
97
                                         gchar            c);
98
GLIB_AVAILABLE_IN_ALL
99
GString*     g_string_prepend_unichar   (GString         *string,
100
                                         gunichar         wc);
101
GLIB_AVAILABLE_IN_ALL
102
GString*     g_string_prepend_len       (GString         *string,
103
                                         const gchar     *val,
104
                                         gssize           len);
105
GLIB_AVAILABLE_IN_ALL
106
GString*     g_string_insert            (GString         *string,
107
                                         gssize           pos,
108
                                         const gchar     *val);
109
GLIB_AVAILABLE_IN_ALL
110
GString*     g_string_insert_c          (GString         *string,
111
                                         gssize           pos,
112
                                         gchar            c);
113
GLIB_AVAILABLE_IN_ALL
114
GString*     g_string_insert_unichar    (GString         *string,
115
                                         gssize           pos,
116
                                         gunichar         wc);
117
GLIB_AVAILABLE_IN_ALL
118
GString*     g_string_overwrite         (GString         *string,
119
                                         gsize            pos,
120
                                         const gchar     *val);
121
GLIB_AVAILABLE_IN_ALL
122
GString*     g_string_overwrite_len     (GString         *string,
123
                                         gsize            pos,
124
                                         const gchar     *val,
125
                                         gssize           len);
126
GLIB_AVAILABLE_IN_ALL
127
GString*     g_string_erase             (GString         *string,
128
                                         gssize           pos,
129
                                         gssize           len);
130
GLIB_AVAILABLE_IN_ALL
131
GString*     g_string_ascii_down        (GString         *string);
132
GLIB_AVAILABLE_IN_ALL
133
GString*     g_string_ascii_up          (GString         *string);
134
GLIB_AVAILABLE_IN_ALL
135
void         g_string_vprintf           (GString         *string,
136
                                         const gchar     *format,
137
                                         va_list          args)
138
                                         G_GNUC_PRINTF(2, 0);
139
GLIB_AVAILABLE_IN_ALL
140
void         g_string_printf            (GString         *string,
141
                                         const gchar     *format,
142
                                         ...) G_GNUC_PRINTF (2, 3);
143
GLIB_AVAILABLE_IN_ALL
144
void         g_string_append_vprintf    (GString         *string,
145
                                         const gchar     *format,
146
                                         va_list          args)
147
                                         G_GNUC_PRINTF(2, 0);
148
GLIB_AVAILABLE_IN_ALL
149
void         g_string_append_printf     (GString         *string,
150
                                         const gchar     *format,
151
                                         ...) G_GNUC_PRINTF (2, 3);
152
GLIB_AVAILABLE_IN_ALL
153
GString*     g_string_append_uri_escaped (GString         *string,
154
                                          const gchar     *unescaped,
155
                                          const gchar     *reserved_chars_allowed,
156
                                          gboolean         allow_utf8);
157
158
/* -- optimize g_strig_append_c --- */
159
#ifdef G_CAN_INLINE
160
static inline GString*
161
g_string_append_c_inline (GString *gstring,
162
                          gchar    c)
163
0
{
164
0
  if (gstring->len + 1 < gstring->allocated_len)
165
0
    {
166
0
      gstring->str[gstring->len++] = c;
167
0
      gstring->str[gstring->len] = 0;
168
0
    }
169
0
  else
170
0
    g_string_insert_c (gstring, -1, c);
171
0
  return gstring;
172
0
}
Unexecuted instantiation: fuzzing-main.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: binding-handler.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: boolcfg-stub.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: device-energy-management-stub.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: energy-evse-stub.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: occupancy-sensing-stub.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: operational-state-delegate-impl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: smco-stub.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: software-diagnostics-stub.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: wifi-diagnostics-stub.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DeviceEnergyManagementDelegateImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DeviceEnergyManagementManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: device-energy-management-mode.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ChargingTargetsMemMgr.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: EVSEManufacturerImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: EnergyEvseDelegateImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: EnergyEvseManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: EnergyEvseTargetsStore.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: energy-evse-mode.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: WhmDelegateImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: WhmInstance.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: WhmMain.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: WhmManufacturer.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: water-heater-mode.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: thermostat-delegate-impl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: AllClustersCommandDelegate.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: AppOptions.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ButtonEventsSimulator.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: WindowCoveringManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: main-common.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: AppMain.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CommissionableInit.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: Options.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CustomCSRResponse.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: reporting.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: attribute-storage.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: access-control-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CodegenIntegration.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: basic-information.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: BindingManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: bindings.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: camera-av-settings-user-level-management-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: camera-av-stream-management-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: color-control-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: descriptor.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: device-energy-management-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: dishwasher-alarm-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: energy-evse-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: fault-injection-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: fixed-label-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: general-commissioning-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: general-diagnostics-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: group-key-mgmt-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: identify-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: laundry-dryer-controls-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: laundry-washer-controls-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: level-control.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: localization-configuration-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: mode-base-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: mode-select-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CodegenInstance.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: on-off-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: operational-credentials-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: operational-state-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: BDXDownloader.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DefaultOTARequestor.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DefaultOTARequestorDriver.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ExtendedOTARequestorDriver.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: pump-configuration-and-control-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: refrigerator-alarm-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: resource-monitoring-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: scenes-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: switch-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: temperature-control-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: test-cluster-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: thermostat-server-atomic.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: thermostat-server-presets.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: thermostat-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: thread-network-diagnostics-provider.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: thread-network-diagnostics-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: time-format-localization-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: time-synchronization-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: user-label-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: valve-configuration-and-control-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: water-heater-management-server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: IMClusterCommandHandler.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: AdministratorCommissioningCluster.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: AdministratorCommissioningLogic.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: NetworkCommissioningCluster.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: NetworkCommissioningLogic.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: OnboardingCodesUtil.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: EventManagement.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: FailSafeContext.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ReliableMessageContext.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ReliableMessageMgr.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ReliableMessageProtocolConfig.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DeviceControlServer.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: Globals.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: LockTracker.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: PlatformEventSupport.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: SingletonConfigurationManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CHIPLinuxStorage.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CHIPLinuxStorageIni.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ConfigurationManagerImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ConnectivityManagerImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ConnectivityUtils.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DiagnosticDataProviderImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: NetworkCommissioningEthernetDriver.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: PlatformManagerImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: GeneralUtils.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DeviceInstanceInfoProviderImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: PosixConfig.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: SystemTimeSupport.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: BLEManagerImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: BluezAdvertisement.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: BluezConnection.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: BluezEndpoint.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: BluezObjectManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ChipDeviceScanner.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: NetworkCommissioningWiFiDriver.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DBusWpa.c:g_string_append_c_inline
Unexecuted instantiation: DBusWpaBss.c:g_string_append_c_inline
Unexecuted instantiation: DBusWpaInterface.c:g_string_append_c_inline
Unexecuted instantiation: DBusWpaNetwork.c:g_string_append_c_inline
Unexecuted instantiation: DBusBluez.c:g_string_append_c_inline
Unexecuted instantiation: SessionManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: LastKnownGoodTime.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CASESessionManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: InteractionModelEngine.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: WriteHandler.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CommandResponseSender.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ReadHandler.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: OperationalSessionSetup.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CASESession.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: PairingSession.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: Engine.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ReadClient.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: SubscriptionResumptionSessionEstablisher.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: Server.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: CommissioningWindowManager.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: Dnssd.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: ReportSchedulerImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: WiFiPAF.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: TimerDelegates.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: AllClustersExampleDeviceInfoProviderImpl.cpp:g_string_append_c_inline(_GString*, char)
Unexecuted instantiation: DeviceInfoProviderImpl.cpp:g_string_append_c_inline(_GString*, char)
173
#define g_string_append_c(gstr,c)       g_string_append_c_inline (gstr, c)
174
#endif /* G_CAN_INLINE */
175
176
177
GLIB_DEPRECATED
178
GString *g_string_down (GString *string);
179
GLIB_DEPRECATED
180
GString *g_string_up   (GString *string);
181
182
#define  g_string_sprintf  g_string_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_printf)
183
#define  g_string_sprintfa g_string_append_printf GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_string_append_printf)
184
185
G_END_DECLS
186
187
#endif /* __G_STRING_H__ */