variant: produce stable results

Improve the output by ensuring a well defined order for type switches.

* src/uniqstr.h: Style changes for macro arguments.
(UNIQSTR_CMP): Replace by...
(uniqstr_cmp): this.
* src/uniqstr.c (uniqstr_cmp): New.
Produce well defined results.
* src/output.c: Use it.
This commit is contained in:
Akim Demaille
2012-12-22 10:16:49 +01:00
parent e38106582f
commit 55439a1cea
3 changed files with 17 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ uniqstr uniqstr_vsprintf (char const *format, ...)
/* Compare two uniqstr a la strcmp: negative for <, nul for =, and
positive for >. Undefined order, relies on addresses. */
# define UNIQSTR_CMP(USTR1, USTR2) ((USTR1) - (USTR2))
int uniqstr_cmp(uniqstr u1, uniqstr u2);
/* Die if STR is not a uniqstr. */
void uniqstr_assert (char const *str);