[gtk+/wip/otte/shader: 21/55] gsksltype: Generate better type names
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 21/55] gsksltype: Generate better type names
- Date: Tue, 3 Oct 2017 03:40:44 +0000 (UTC)
commit 0b902f303788e99f4d664e90b8f28af40bae2cda
Author: Benjamin Otte <otte redhat com>
Date: Thu Sep 28 03:42:57 2017 +0200
gsksltype: Generate better type names
If multiple consecutive struct names share their types, use comma
notation to goup them.
gsk/gsksltype.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gsk/gsksltype.c b/gsk/gsksltype.c
index 285f7fd..22e60ed 100644
--- a/gsk/gsksltype.c
+++ b/gsk/gsksltype.c
@@ -1717,7 +1717,7 @@ static char *
gsk_sl_type_builder_generate_name (GskSlTypeBuilder *builder)
{
GString *string = g_string_new ("struct { ");
- guint i;
+ guint i, j;
for (i = 0; i < builder->members->len; i++)
{
@@ -1725,6 +1725,15 @@ gsk_sl_type_builder_generate_name (GskSlTypeBuilder *builder)
g_string_append (string, gsk_sl_type_get_name (m->type));
g_string_append (string, " ");
g_string_append (string, m->name);
+ for (j = i + 1; j < builder->members->len; j++)
+ {
+ GskSlTypeMember *n = &g_array_index (builder->members, GskSlTypeMember, j);
+ if (!gsk_sl_type_equal (m->type, n->type))
+ break;
+ g_string_append (string, ", ");
+ g_string_append (string, n->name);
+ }
+ i = j - 1;
g_string_append (string, "; ");
}
g_string_append (string, "}");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]