1.1 --- a/src/Zone.cpp Sat Dec 29 00:12:27 2012 -0800
1.2 +++ b/src/Zone.cpp Sat Dec 29 00:55:38 2012 -0800
1.3 @@ -226,8 +226,8 @@
1.4 # define VA_COPY(to, from) va_copy(to, from)
1.5 #endif
1.6
1.7 -static char *
1.8 -BuildErrorMessage(const char *format, va_list ap)
1.9 +char *
1.10 +ke::BuildErrorMessage(const char *format, va_list ap)
1.11 {
1.12 va_list use;
1.13 VA_COPY(use, ap);
1.14 @@ -264,6 +264,12 @@
1.15 }
1.16
1.17 void
1.18 +ke::FreeErrorMessage(const char *message)
1.19 +{
1.20 + free((void *)message);
1.21 +}
1.22 +
1.23 +void
1.24 Zone::reportErrorVA(Message message, va_list ap)
1.25 {
1.26 char *report = BuildErrorMessage(Messages[message].format, ap);
1.27 @@ -281,40 +287,7 @@
1.28
1.29 hasPendingException_ = true;
1.30
1.31 - free(report);
1.32 -}
1.33 -
1.34 -void
1.35 -Zone::beginCompilationErrors(const char *file)
1.36 -{
1.37 - if (reporter_)
1.38 - reporter_->beginCompilationErrors(file);
1.39 -}
1.40 -
1.41 -void
1.42 -Zone::reportCompilationError(Message message, unsigned line, unsigned col, va_list ap)
1.43 -{
1.44 - char *report = BuildErrorMessage(Messages[message].format, ap);
1.45 - if (!report) {
1.46 - reportOutOfMemory();
1.47 - return;
1.48 - }
1.49 -
1.50 - if (reporter_) {
1.51 - // Reporters can re-enter. When we start having actual exception
1.52 - // objects that can be caught and inspected, this code will have to
1.53 - // save and restore the exception state.
1.54 - reporter_->reportCompilationError(report, line, col);
1.55 - }
1.56 -
1.57 - free(report);
1.58 -}
1.59 -
1.60 -void
1.61 -Zone::endCompilationErrors()
1.62 -{
1.63 - if (reporter_)
1.64 - reporter_->endCompilationErrors();
1.65 + FreeErrorMessage(report);
1.66 }
1.67
1.68 void