[gnome-builder/wip/chergert/clang] highlight: avoid allocating key
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/clang] highlight: avoid allocating key
- Date: Fri, 27 Apr 2018 08:18:53 +0000 (UTC)
commit 732e21630061c23dc33d0c22d018413caf912b32
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 27 01:04:50 2018 -0700
highlight: avoid allocating key
We can just use the embedded \0 terminated key
that is inside the variant.
src/libide/highlighting/ide-highlight-index.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/highlighting/ide-highlight-index.c b/src/libide/highlighting/ide-highlight-index.c
index f863ef577..afc0d97d7 100644
--- a/src/libide/highlighting/ide-highlight-index.c
+++ b/src/libide/highlighting/ide-highlight-index.c
@@ -81,19 +81,17 @@ ide_highlight_index_new_from_variant (GVariant *variant)
{
GVariantIter iter;
GVariant *value;
- gchar *key;
+ const gchar *tag;
g_variant_iter_init (&iter, variant);
- while (g_variant_iter_loop (&iter, "{sv}", &key, &value))
+ while (g_variant_iter_loop (&iter, "{&sv}", &tag, &value))
{
if (g_variant_is_of_type (value, G_VARIANT_TYPE_STRING_ARRAY))
{
g_autofree const gchar **strv = NULL;
- const gchar *tag;
gsize len;
- tag = g_string_chunk_insert (self->strings, key);
strv = g_variant_get_strv (value, &len);
for (gsize i = 0; i < len; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]