<div dir="ltr"><div><div>The code looks clearer, seems working and I haven't found any issue in the code, therefore:<br><br></div>Reviewed-by: Marek Chalupa <<a href="mailto:mchqwerty@gmail.com">mchqwerty@gmail.com</a>><br>
<br></div>For both patches<br><div class="gmail_extra"><br><br><div class="gmail_quote">On 9 August 2014 00:22, Jasper St. Pierre <span dir="ltr"><<a href="mailto:jstpierre@mecheye.net" target="_blank">jstpierre@mecheye.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">"is_interface" is a really terrible name for the client or server<br>
variants, and instead of checking whether we were passed the requests or<br>
the events, just pass an argument through.<br>
---<br>
 src/scanner.c | 25 ++++++++++++-------------<br>
 1 file changed, 12 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/src/scanner.c b/src/scanner.c<br>
index 51ecb55..72fd3e8 100644<br>
--- a/src/scanner.c<br>
+++ b/src/scanner.c<br>
@@ -851,16 +851,15 @@ emit_enumerations(struct interface *interface)<br>
 }<br>
<br>
 static void<br>
-emit_structs(struct wl_list *message_list, struct interface *interface)<br>
+emit_structs(struct wl_list *message_list, struct interface *interface, enum side side)<br>
 {<br>
        struct message *m;<br>
        struct arg *a;<br>
-       int is_interface, n;<br>
+       int n;<br>
<br>
        if (wl_list_empty(message_list))<br>
                return;<br>
<br>
-       is_interface = message_list == &interface->request_list;<br>
        if (interface->description) {<br>
                struct description *desc = interface->description;<br>
                printf("/**\n");<br>
@@ -876,7 +875,7 @@ emit_structs(struct wl_list *message_list, struct interface *interface)<br>
                printf(" */\n");<br>
        }<br>
        printf("struct %s_%s {\n", interface->name,<br>
-              is_interface ? "interface" : "listener");<br>
+              (side == SERVER) ? "interface" : "listener");<br>
<br>
        wl_list_for_each(m, message_list, link) {<br>
                struct description *mdesc = m->description;<br>
@@ -886,7 +885,7 @@ emit_structs(struct wl_list *message_list, struct interface *interface)<br>
                          "\t * %s - ", m->name);<br>
                wl_list_for_each(a, &m->arg_list, link) {<br>
<br>
-                       if (is_interface && a->type == NEW_ID &&<br>
+                       if (side == SERVER && a->type == NEW_ID &&<br>
                            a->interface_name == NULL)<br>
                                printf("\t * @interface: name of the objects interface\n"<br>
                                       "\t * @version: version of the objects interface\n");<br>
@@ -906,7 +905,7 @@ emit_structs(struct wl_list *message_list, struct interface *interface)<br>
                printf("\tvoid (*%s)(", m->name);<br>
<br>
                n = strlen(m->name) + 17;<br>
-               if (is_interface) {<br>
+               if (side == SERVER) {<br>
                        printf("struct wl_client *client,\n"<br>
                               "%sstruct wl_resource *resource",<br>
                               indent(n));<br>
@@ -919,14 +918,14 @@ emit_structs(struct wl_list *message_list, struct interface *interface)<br>
                wl_list_for_each(a, &m->arg_list, link) {<br>
                        printf(",\n%s", indent(n));<br>
<br>
-                       if (is_interface && a->type == OBJECT)<br>
+                       if (side == SERVER && a->type == OBJECT)<br>
                                printf("struct wl_resource *");<br>
-                       else if (is_interface && a->type == NEW_ID && a->interface_name == NULL)<br>
+                       else if (side == SERVER && a->type == NEW_ID && a->interface_name == NULL)<br>
                                printf("const char *interface, uint32_t version, uint32_t ");<br>
-                       else if (!is_interface && a->type == OBJECT && a->interface_name == NULL)<br>
+                       else if (side == CLIENT && a->type == OBJECT && a->interface_name == NULL)<br>
                                printf("void *");<br>
<br>
-                       else if (!is_interface && a->type == NEW_ID)<br>
+                       else if (side == CLIENT && a->type == NEW_ID)<br>
                                printf("struct %s *", a->interface_name);<br>
                        else<br>
                                emit_type(a);<br>
@@ -939,7 +938,7 @@ emit_structs(struct wl_list *message_list, struct interface *interface)<br>
<br>
        printf("};\n\n");<br>
<br>
-       if (!is_interface) {<br>
+       if (side == CLIENT) {<br>
            printf("static inline int\n"<br>
                   "%s_add_listener(struct %s *%s,\n"<br>
                   "%sconst struct %s_listener *listener, void *data)\n"<br>
@@ -1019,12 +1018,12 @@ emit_header(struct protocol *protocol, enum side side)<br>
                emit_enumerations(i);<br>
<br>
                if (side == SERVER) {<br>
-                       emit_structs(&i->request_list, i);<br>
+                       emit_structs(&i->request_list, i, side);<br>
                        emit_opcodes(&i->event_list, i);<br>
                        emit_opcode_versions(&i->event_list, i);<br>
                        emit_event_wrappers(&i->event_list, i);<br>
                } else {<br>
-                       emit_structs(&i->event_list, i);<br>
+                       emit_structs(&i->event_list, i, side);<br>
                        emit_opcodes(&i->request_list, i);<br>
                        emit_stubs(&i->request_list, i);<br>
                }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.0.4<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div><div class="gmail_extra">Regards,<br>Marek<br></div></div>