switch (type)
{ case ET_WARNING:
fprintf(stderr, _("WARNING: ")); break; case ET_ERROR:
fprintf(stderr, _("ERROR: ")); break;
}
vfprintf(stderr, error, ap);
fprintf(stderr, "\n");
/* If appropriate, set error code to be inspected by ecpg.c */ switch (type)
{ case ET_WARNING: break; case ET_ERROR:
ret_value = error_code; break;
}
}
/* Report an error or warning */ void
mmerror(int error_code, enum errortype type, constchar *error,...)
{
va_list ap;
typedefstruct loc_chunk
{ struct loc_chunk *next; /* list link */ unsignedint chunk_used; /* index of first unused byte in data[] */ unsignedint chunk_avail; /* # bytes still available in data[] */ char data[FLEXIBLE_ARRAY_MEMBER]; /* actual storage */
} loc_chunk;
/* Ensure all allocations are adequately aligned */
size = MAXALIGN(size);
/* Need a new chunk? */ if (cur_chunk == NULL || size > cur_chunk->chunk_avail)
{
size_t chunk_size = Max(size, LOC_CHUNK_MIN_SIZE);
cur_chunk = mm_alloc(chunk_size + LOC_CHUNK_OVERHEAD); /* Depending on alignment rules, we could waste a bit here */
cur_chunk->chunk_used = LOC_CHUNK_OVERHEAD - offsetof(loc_chunk, data);
cur_chunk->chunk_avail = chunk_size; /* New chunk becomes the head of the list */
cur_chunk->next = loc_chunks;
loc_chunks = cur_chunk;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.