src/sysdep/linux/graphics.c
static int x11_error_handler(Display *display, XErrorEvent *error)
{
    if (x11_error) {
        /* Don't report subsequent errors (since they were probably caused
         * by the first error). */
        return 0;
    }
    x11_error = error->error_code;

    char error_name[1000];
    XGetErrorText(display, error->error_code, error_name,
                  sizeof(error_name));

    char request_code[8];
    char request_name[1000];
    if (error->request_code < 128) {
        ASSERT(strformat_check(request_code, sizeof(request_code), "%d",
                               error->request_code));
        XGetErrorDatabaseText(display, "XRequest", request_code,
                              "???", request_name, sizeof(request_name));
    } else {
        ASSERT(strformat_check(request_code, sizeof(request_code), "%d.%d",
                               error->request_code, error->minor_code));
        char extended_code[1000];
        ASSERT(strformat_check(extended_code, sizeof(extended_code), "%s.%d",
                               x11_extensions[error->request_code - 128],
                               error->minor_code));
        XGetErrorDatabaseText(display, "XRequest", extended_code,
                              "???", request_name, sizeof(request_name));
    }

    DLOG("X11 error %d (%s) in request %s (%s)",
         error->error_code, error_name, request_code, request_name);
    return 0;
}
/*************************************************************************/
/***************** Local routines: Low-level X11 helpers *****************/
/*************************************************************************/
Local routines: Low-level X11 helpers
Local routines : Low - level X11 helpers
static int x11_error_handler(Display *display, XErrorEvent *error)
{
    if (x11_error) {
        return 0;
    }
    x11_error = error->error_code;
    char error_name[1000];
    XGetErrorText(display, error->error_code, error_name,
                  sizeof(error_name));
    char request_code[8];
    char request_name[1000];
    if (error->request_code < 128) {
        ASSERT(strformat_check(request_code, sizeof(request_code), "%d",
                               error->request_code));
        XGetErrorDatabaseText(display, "XRequest", request_code,
                              "???", request_name, sizeof(request_name));
    } else {
        ASSERT(strformat_check(request_code, sizeof(request_code), "%d.%d",
                               error->request_code, error->minor_code));
        char extended_code[1000];
        ASSERT(strformat_check(extended_code, sizeof(extended_code), "%s.%d",
                               x11_extensions[error->request_code - 128],
                               error->minor_code));
        XGetErrorDatabaseText(display, "XRequest", extended_code,
                              "???", request_name, sizeof(request_name));
    }
    DLOG("X11 error %d (%s) in request %s (%s)",
         error->error_code, error_name, request_code, request_name);
    return 0;
}
static int x11_error_handler ( Display * display , XErrorEvent * error ) { if ( x11_error ) { return 0 ; } x11_error = error -> error_code ; char error_name [ 1000 ] ; XGetErrorText ( display , error -> error_code , error_name , sizeof ( error_name ) ) ; char request_code [ 8 ] ; char request_name [ 1000 ] ; if ( error -> request_code < 128 ) { ASSERT ( strformat_check ( request_code , sizeof ( request_code ) , " " , error -> request_code ) ) ; XGetErrorDatabaseText ( display , " " , request_code , " " , request_name , sizeof ( request_name ) ) ; } else { ASSERT ( strformat_check ( request_code , sizeof ( request_code ) , " " , error -> request_code , error -> minor_code ) ) ; char extended_code [ 1000 ] ; ASSERT ( strformat_check ( extended_code , sizeof ( extended_code ) , " " , x11_extensions [ error -> request_code - 128 ] , error -> minor_code ) ) ; XGetErrorDatabaseText ( display , " " , extended_code , " " , request_name , sizeof ( request_name ) ) ; } DLOG ( " " , error -> error_code , error_name , request_code , request_name ) ; return 0 ; }
Local routines: Low-level X11 helpers
Local routines : Low - level X11 helpers
/* Don't report subsequent errors (since they were probably caused
         * by the first error). */