VirtualBox

Ignore:
Timestamp:
Sep 27, 2019 9:45:46 AM (5 years ago)
Author:
vboxsync
Message:

Additions/VBoxClient: Revamped and unified local logging infrastructure; cleaned up a lot of different logging styles / ways. Fixed logging memory leaks.

Location:
trunk/src/VBox/Additions/x11/VBoxClient/testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp

    r76553 r81040  
    4646#define TEST_ROOT ((Window)1)
    4747
    48 extern void vbclFatalError(char *psz)
    49 {
    50     RTPrintf("Fatal error: %s\n", psz);
     48void VBClLogError(const char *pszFormat, ...)
     49{
     50    va_list args;
     51    va_start(args, pszFormat);
     52    char *psz = NULL;
     53    RTStrAPrintfV(&psz, pszFormat, args);
     54    va_end(args);
     55
     56    AssertPtr(psz);
     57    RTPrintf("Error: %s", psz);
     58
     59    RTStrFree(psz);
     60}
     61
     62/** Exit with a fatal error. */
     63void VBClLogFatalError(const char *pszFormat, ...)
     64{
     65    va_list args;
     66    va_start(args, pszFormat);
     67    char *psz = NULL;
     68    RTStrAPrintfV(&psz, pszFormat, args);
     69    va_end(args);
     70
     71    AssertPtr(psz);
     72    RTPrintf("Fatal error: %s", psz);
     73
     74    RTStrFree(psz);
     75
    5176    exit(1);
    5277}
  • trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp

    r76553 r81040  
    2121#include <iprt/initterm.h>
    2222#include <iprt/semaphore.h>
     23#include <iprt/string.h>
    2324#include <iprt/stream.h>
    2425#include <VBox/VBoxGuestLib.h>
     
    2829static RTSEMEVENT eventSem;
    2930
     31void VBClLogError(const char *pszFormat, ...)
     32{
     33    va_list args;
     34    va_start(args, pszFormat);
     35    char *psz = NULL;
     36    RTStrAPrintfV(&psz, pszFormat, args);
     37    va_end(args);
     38
     39    AssertPtr(psz);
     40    RTPrintf("Error: %s", psz);
     41
     42    RTStrFree(psz);
     43}
     44
    3045/** Exit with a fatal error. */
    31 void vbclFatalError(char *pszMessage)
     46void VBClLogFatalError(const char *pszFormat, ...)
    3247{
    33     RTPrintf("Fatal error: %s", pszMessage);
     48    va_list args;
     49    va_start(args, pszFormat);
     50    char *psz = NULL;
     51    RTStrAPrintfV(&psz, pszFormat, args);
     52    va_end(args);
     53
     54    AssertPtr(psz);
     55    RTPrintf("Fatal error: %s", psz);
     56
     57    RTStrFree(psz);
     58
    3459    exit(1);
    3560}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette