summaryrefslogtreecommitdiffstats
path: root/lib/glibcompat.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:11:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:11:51 +0000
commita6f3675fc4e21b3f899286b9a02005368d913f74 (patch)
treec9bfa92b223783ff03b8e941c3bb0d36c68d3b5e /lib/glibcompat.c
parentReleasing progress-linux version 3:4.8.30-1~progress7.99u1. (diff)
downloadmc-a6f3675fc4e21b3f899286b9a02005368d913f74.tar.xz
mc-a6f3675fc4e21b3f899286b9a02005368d913f74.zip
Merging upstream version 3:4.8.31.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/glibcompat.c')
-rw-r--r--lib/glibcompat.c58
1 files changed, 36 insertions, 22 deletions
diff --git a/lib/glibcompat.c b/lib/glibcompat.c
index 0522c0f..0d58e49 100644
--- a/lib/glibcompat.c
+++ b/lib/glibcompat.c
@@ -1,7 +1,7 @@
/*
GLIB - Library of useful routines for C programming
- Copyright (C) 2009-2023
+ Copyright (C) 2009-2024
Free Software Foundation, Inc.
Written by:
@@ -111,29 +111,8 @@ g_clear_list (GList ** list_ptr, GDestroyNotify destroy)
}
}
-/* --------------------------------------------------------------------------------------------- */
-
#endif /* ! GLIB_CHECK_VERSION (2, 63, 3) */
-#if ! GLIB_CHECK_VERSION (2, 32, 0)
-/**
- * g_queue_free_full:
- * @queue: a pointer to a #GQueue
- * @free_func: the function to be called to free each element's data
- *
- * Convenience method, which frees all the memory used by a #GQueue,
- * and calls the specified destroy function on every element's data.
- *
- * Since: 2.32
- */
-void
-g_queue_free_full (GQueue * queue, GDestroyNotify free_func)
-{
- g_queue_foreach (queue, (GFunc) free_func, NULL);
- g_queue_free (queue);
-}
-#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */
-
/* --------------------------------------------------------------------------------------------- */
#if ! GLIB_CHECK_VERSION (2, 60, 0)
@@ -161,6 +140,41 @@ g_queue_clear_full (GQueue * queue, GDestroyNotify free_func)
/* --------------------------------------------------------------------------------------------- */
+#if ! GLIB_CHECK_VERSION (2, 77, 0)
+/**
+ * g_string_new_take:
+ * @init: (nullable): initial text used as the string.
+ * Ownership of the string is transferred to the #GString.
+ * Passing NULL creates an empty string.
+ *
+ * Creates a new #GString, initialized with the given string.
+ *
+ * After this call, @init belongs to the #GString and may no longer be
+ * modified by the caller. The memory of @data has to be dynamically
+ * allocated and will eventually be freed with g_free().
+ *
+ * Returns: the new #GString
+ */
+GString *
+g_string_new_take (char *init)
+{
+ GString *string;
+
+ if (init == NULL)
+ return g_string_new (NULL);
+
+ string = g_slice_new (GString);
+
+ string->str = init;
+ string->len = strlen (string->str);
+ string->allocated_len = string->len + 1;
+
+ return string;
+}
+#endif /* ! GLIB_CHECK_VERSION (2, 77, 0) */
+
+/* --------------------------------------------------------------------------------------------- */
+
/**
* mc_g_string_copy:
* @dest: (not nullable): the destination #GString. Its current contents are destroyed