mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
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:
@@ -103,7 +103,17 @@ uniqstr_print_processor (void *ustr, void *null ATTRIBUTE_UNUSED)
|
||||
return uniqstr_print (ustr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
uniqstr_cmp(uniqstr l, uniqstr r)
|
||||
{
|
||||
return (l == r ? 0
|
||||
: !l ? -1
|
||||
: !r ? +1
|
||||
: strcmp (l, r));
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------.
|
||||
| A uniqstr hash table. |
|
||||
`-----------------------*/
|
||||
@@ -120,6 +130,7 @@ hash_uniqstr (void const *m, size_t tablesize)
|
||||
return hash_string (m, tablesize);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------.
|
||||
| Create the uniqstrs table. |
|
||||
`----------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user