summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Blin <dev@blino.org>2012-10-15 00:49:11 +0200
committerKristian Høgsberg <krh@bitplanet.net>2012-10-15 13:04:07 -0400
commitf36c61571f66e79ddd5be38f094067b1fb09f86a (patch)
tree8ad1b029d5d94a3f5dfa42713a3ce6e37a40f98f
parentdc28c0bafda013af761510f23942c5f2305c5808 (diff)
scanner: fix writing i586 descriptions
This moves desc as first argument of desc_dump(). Description writing was broken on i586 because desc_dump() used va_arg() after a vsnprintf() call to find the last argument. But after calling a function with a va_arg argument, this arguments is undefined.
-rw-r--r--src/scanner.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/scanner.c b/src/scanner.c
index 3d0ba0b..d0e64c0 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -158,15 +158,14 @@ static const char *indent(int n)
}
static void
-desc_dump(const char *fmt, ...)
+desc_dump(char *desc, const char *fmt, ...)
{
va_list ap;
- char buf[128], *desc, hang;
+ char buf[128], hang;
int col, i, j, k, startcol;
va_start(ap, fmt);
vsnprintf(buf, sizeof buf, fmt, ap);
- desc = va_arg(ap, char *);
va_end(ap);
for (i = 0, col = 0; buf[i] != '*'; i++) {
@@ -718,18 +717,19 @@ emit_enumerations(struct interface *interface)
if (desc) {
printf("/**\n");
- desc_dump(" * %s_%s - ",
- interface->name, e->name, desc->summary);
+ desc_dump(desc->summary,
+ " * %s_%s - ",
+ interface->name, e->name);
wl_list_for_each(entry, &e->entry_list, link) {
- desc_dump(" * @%s_%s_%s: ",
+ desc_dump(entry->summary,
+ " * @%s_%s_%s: ",
interface->uppercase_name,
e->uppercase_name,
- entry->uppercase_name,
- entry->summary);
+ entry->uppercase_name);
}
if (desc->text) {
printf(" *\n");
- desc_dump(" * ", desc->text);
+ desc_dump(desc->text, " * ");
}
printf(" */\n");
}
@@ -759,14 +759,15 @@ emit_structs(struct wl_list *message_list, struct interface *interface)
if (interface->description) {
struct description *desc = interface->description;
printf("/**\n");
- desc_dump(" * %s - ", interface->name, desc->summary);
+ desc_dump(desc->summary, " * %s - ", interface->name);
wl_list_for_each(m, message_list, link) {
struct description *mdesc = m->description;
- desc_dump(" * @%s: ",
- m->name, mdesc ? mdesc->summary : "(none)");
+ desc_dump(mdesc ? mdesc->summary : "(none)",
+ " * @%s: ",
+ m->name);
}
printf(" *\n");
- desc_dump(" * ", desc->text);
+ desc_dump(desc->text, " * ");
printf(" */\n");
}
printf("struct %s_%s {\n", interface->name,
@@ -776,8 +777,8 @@ emit_structs(struct wl_list *message_list, struct interface *interface)
struct description *mdesc = m->description;
printf("\t/**\n");
- desc_dump("\t * %s - ",
- m->name, mdesc ? mdesc->summary : "(none)");
+ desc_dump(mdesc ? mdesc->summary : "(none)",
+ "\t * %s - ", m->name);
wl_list_for_each(a, &m->arg_list, link) {
if (is_interface && a->type == NEW_ID &&
@@ -786,12 +787,12 @@ emit_structs(struct wl_list *message_list, struct interface *interface)
"\t * @version: version of the objects interface\n");
- desc_dump("\t * @%s: ",
- a->name, a->summary ? a->summary : "(none)");
+ desc_dump(a->summary ? a->summary : "(none)",
+ "\t * @%s: ", a->name);
}
if (mdesc) {
printf("\t *\n");
- desc_dump("\t * ", mdesc->text);
+ desc_dump(mdesc->text, "\t * ");
}
if (m->since > 1) {
printf("\t * @since: %d\n", m->since);