diff -r 82b1f8bc93a9 -r 0998a43cc155 src/Zone.cpp --- a/src/Zone.cpp Sat Dec 29 00:12:27 2012 -0800 +++ b/src/Zone.cpp Sat Dec 29 00:55:38 2012 -0800 @@ -226,8 +226,8 @@ # define VA_COPY(to, from) va_copy(to, from) #endif -static char * -BuildErrorMessage(const char *format, va_list ap) +char * +ke::BuildErrorMessage(const char *format, va_list ap) { va_list use; VA_COPY(use, ap); @@ -264,6 +264,12 @@ } void +ke::FreeErrorMessage(const char *message) +{ + free((void *)message); +} + +void Zone::reportErrorVA(Message message, va_list ap) { char *report = BuildErrorMessage(Messages[message].format, ap); @@ -281,40 +287,7 @@ hasPendingException_ = true; - free(report); -} - -void -Zone::beginCompilationErrors(const char *file) -{ - if (reporter_) - reporter_->beginCompilationErrors(file); -} - -void -Zone::reportCompilationError(Message message, unsigned line, unsigned col, va_list ap) -{ - char *report = BuildErrorMessage(Messages[message].format, ap); - if (!report) { - reportOutOfMemory(); - return; - } - - if (reporter_) { - // Reporters can re-enter. When we start having actual exception - // objects that can be caught and inspected, this code will have to - // save and restore the exception state. - reporter_->reportCompilationError(report, line, col); - } - - free(report); -} - -void -Zone::endCompilationErrors() -{ - if (reporter_) - reporter_->endCompilationErrors(); + FreeErrorMessage(report); } void