[gtk+/wip/otte/shader: 33/69] gsksltype: Generate better type names
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 33/69] gsksltype: Generate better type names
- Date: Wed, 4 Oct 2017 00:39:58 +0000 (UTC)
commit db715c666f2a6116b5d03479d49675e32e4a6be1
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 5a9b9bd..761bd65 100644
--- a/gsk/gsksltype.c
+++ b/gsk/gsksltype.c
@@ -1718,7 +1718,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++)
{
@@ -1726,6 +1726,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]