-/* Should each complaint message be self explanatory, or should we
- assume that a series of complaints is being produced? */
-
-enum complaint_series {
- /* Isolated self explanatory message. */
- ISOLATED_MESSAGE,
-
- /* First message of a series, but does not need to include any sort
- of explanation. */
- SHORT_FIRST_MESSAGE,
-};
-
-/* Structure to manage complaints about symbol file contents. */
-
-struct complain
-{
- const char *file;
- int line;
- const char *fmt;
- int counter;
- struct complain *next;
-};
-
-struct complaints
-{
- struct complain *root;
-
- enum complaint_series series;
-};
-
-static struct complain complaint_sentinel;
-
-static struct complaints symfile_complaint_book = {
- &complaint_sentinel,
- ISOLATED_MESSAGE
-};
-
-static struct complain * ATTRIBUTE_PRINTF (4, 0)
-find_complaint (struct complaints *complaints, const char *file,
- int line, const char *fmt)
-{
- struct complain *complaint;
-
- /* Find the complaint in the table. A more efficient search
- algorithm (based on hash table or something) could be used. But
- that can wait until someone shows evidence that this lookup is
- a real bottle neck. */
- for (complaint = complaints->root;
- complaint != NULL;
- complaint = complaint->next)
- {
- if (complaint->fmt == fmt
- && complaint->file == file
- && complaint->line == line)
- return complaint;
- }
-
- /* Oops not seen before, fill in a new complaint. */
- complaint = XNEW (struct complain);
- complaint->fmt = fmt;
- complaint->file = file;
- complaint->line = line;
- complaint->counter = 0;
- complaint->next = NULL;
-
- /* File it, return it. */
- complaint->next = complaints->root;
- complaints->root = complaint;
- return complaint;
-}