]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - error.c
cache filenames as such instead of using code_cachedstring
[xonotic/gmqcc.git] / error.c
diff --git a/error.c b/error.c
index 6e09f396e2aacac131345255d55de266706d7e18..e6a1c7da2f5f499f483d03b2de47c462e0756803 100644 (file)
--- a/error.c
+++ b/error.c
@@ -37,21 +37,34 @@ int levelcolor[] = {
 };
 #endif
 
-void vprintmsg(int level, const char *name, size_t line, char *errtype, const char *msg, va_list ap)
+void vprintmsg(int level, const char *name, size_t line, const char *msgtype, const char *msg, va_list ap)
 {
 #ifndef WIN32
-    fprintf (stderr, "\033[0;%dm%s:%d \033[0;%dm%s: \033[0m", CON_CYAN, name, (int)line, levelcolor[level], errtype);
+    fprintf (stderr, "\033[0;%dm%s:%d: \033[0;%dm%s: \033[0m", CON_CYAN, name, (int)line, levelcolor[level], msgtype);
 #else
-    fprintf (stderr, "%s:%d: %s: ", name, line, errtype);
+    fprintf (stderr, "%s:%d: %s: ", name, line, msgtype);
 #endif
     vfprintf(stderr, msg, ap);
     fprintf (stderr, "\n");
 }
 
-void printmsg(int level, const char *name, size_t line, char *errtype, const char *msg, ...)
+void printmsg(int level, const char *name, size_t line, const char *msgtype, const char *msg, ...)
 {
     va_list   va;
     va_start(va, msg);
-    vprintmsg(level, name, line, errtype, msg, va);
+    vprintmsg(level, name, line, msgtype, msg, va);
+    va_end  (va);
+}
+
+void cvprintmsg(lex_ctx ctx, int lvl, const char *msgtype, const char *msg, va_list ap)
+{
+    vprintmsg(lvl, ctx.file, ctx.line, msgtype, msg, ap);
+}
+
+void cprintmsg (lex_ctx ctx, int lvl, const char *msgtype, const char *msg, ...)
+{
+    va_list   va;
+    va_start(va, msg);
+    cvprintmsg(ctx, lvl, msgtype, msg, va);
     va_end  (va);
 }