egl: simplify _eglDebugReport* API
[mesa.git] / src / egl / main / eglcurrent.c
index df0463d70e5a35716257dc466c4206cadb7014f9..db42b45309da10bac86b8900dc676fd5d9cf975a 100644 (file)
@@ -294,37 +294,36 @@ _eglError(EGLint errCode, const char *msg)
    return EGL_FALSE;
 }
 
-/**
- * Returns the label set for the current thread.
- */
-EGLLabelKHR
-_eglGetThreadLabel(void)
-{
-   _EGLThreadInfo *t = _eglGetCurrentThread();
-   return t->Label;
-}
-
-static void
-_eglDebugReportFullv(EGLenum error, const char *command, const char *funcName,
-      EGLint type, EGLLabelKHR objectLabel, const char *message, va_list args)
+void
+_eglDebugReport(EGLenum error, const char *funcName,
+      EGLint type, const char *message, ...)
 {
+   _EGLThreadInfo *thr = _eglGetCurrentThread();
    EGLDEBUGPROCKHR callback = NULL;
+   va_list args;
+
+   if (funcName == NULL)
+      funcName = thr->CurrentFuncName;
 
    mtx_lock(_eglGlobal.Mutex);
    if (_eglGlobal.debugTypesEnabled & DebugBitFromType(type)) {
       callback = _eglGlobal.debugCallback;
    }
+
    mtx_unlock(_eglGlobal.Mutex);
 
    if (callback != NULL) {
       char *buf = NULL;
 
       if (message != NULL) {
+         va_start(args, message);
          if (vasprintf(&buf, message, args) < 0) {
             buf = NULL;
          }
+
+         va_end(args);
       }
-      callback(error, command, type, _eglGetThreadLabel(), objectLabel, buf);
+      callback(error, funcName, type, thr->Label, thr->CurrentObjectLabel, buf);
       free(buf);
    }
 
@@ -332,29 +331,3 @@ _eglDebugReportFullv(EGLenum error, const char *command, const char *funcName,
       _eglInternalError(error, funcName);
    }
 }
-
-void
-_eglDebugReportFull(EGLenum error, const char *command, const char *funcName,
-      EGLint type, EGLLabelKHR objectLabel, const char *message, ...)
-{
-   va_list args;
-   va_start(args, message);
-   _eglDebugReportFullv(error, command, funcName, type, objectLabel, message, args);
-   va_end(args);
-}
-
-void
-_eglDebugReport(EGLenum error, const char *funcName,
-      EGLint type, const char *message, ...)
-{
-   _EGLThreadInfo *thr = _eglGetCurrentThread();
-   va_list args;
-
-   if (funcName == NULL) {
-      funcName = thr->CurrentFuncName;
-   }
-
-   va_start(args, message);
-   _eglDebugReportFullv(error, thr->CurrentFuncName, funcName, type, thr->CurrentObjectLabel, message, args);
-   va_end(args);
-}