Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
grefstring.h
Go to the documentation of this file.
1/* grefstring.h: Reference counted strings
2 *
3 * Copyright 2018 Emmanuele Bassi
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
23#include "gmem.h"
24#include "gmacros.h"
25
27
29char * g_ref_string_new (const char *str);
31char * g_ref_string_new_len (const char *str,
32 gssize len);
34char * g_ref_string_new_intern (const char *str);
35
37char * g_ref_string_acquire (char *str);
39void g_ref_string_release (char *str);
40
43
44/**
45 * GRefString:
46 *
47 * A typedef for a reference-counted string. A pointer to a #GRefString can be
48 * treated like a standard `char*` array by all code, but can additionally have
49 * `g_ref_string_*()` methods called on it. `g_ref_string_*()` methods cannot be
50 * called on `char*` arrays not allocated using g_ref_string_new().
51 *
52 * If using #GRefString with autocleanups, g_autoptr() must be used rather than
53 * g_autofree(), so that the reference counting metadata is also freed.
54 *
55 * Since: 2.58
56 */
57typedef char GRefString;
58
#define GLIB_AVAILABLE_IN_2_58
signed long gssize
Definition glibconfig.h:82
unsigned long gsize
Definition glibconfig.h:83
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
GLIB_AVAILABLE_IN_2_58 char * g_ref_string_acquire(char *str)
char GRefString
Definition grefstring.h:57
G_BEGIN_DECLS GLIB_AVAILABLE_IN_2_58 char * g_ref_string_new(const char *str)
GLIB_AVAILABLE_IN_2_58 char * g_ref_string_new_len(const char *str, gssize len)
GLIB_AVAILABLE_IN_2_58 void g_ref_string_release(char *str)
GLIB_AVAILABLE_IN_2_58 gsize g_ref_string_length(char *str)
GLIB_AVAILABLE_IN_2_58 char * g_ref_string_new_intern(const char *str)