[gtk+/wip/otte/shader: 47/150] gsksltype: Generate better type names
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 47/150] gsksltype: Generate better type names
- Date: Sat, 21 Oct 2017 02:30:07 +0000 (UTC)
commit 5c33bf2c92e20854e0205c2c3c203547f8c54c76
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 18c30ba..a1bcd9e 100644
--- a/gsk/gsksltype.c
+++ b/gsk/gsksltype.c
@@ -1719,7 +1719,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++)
{
@@ -1727,6 +1727,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]