<commit_before>#include <xcb/xcb.h>
#include <xglWsiX11Ext.h>

#include <Windows.h>
#include <string>
#include <deque>

#include <xgl.h>

#include "../loader/loader_platform.h"

typedef void (*xcbCreateWindowType)(uint16_t width, uint16_t height);
typedef void (*xcbDestroyWindowType)();
typedef int (*xcbGetMessageType)(MSG * msg);
typedef BOOL (*xcbPeekMessageType)(MSG * msg);
typedef XGL_RESULT (*xcbQueuePresentType)(XGL_QUEUE queue, XGL_IMAGE image, XGL_FENCE fence);

struct xcb_connection_t {
    xcb_screen_t screens[1];
    xcb_setup_t setup;
    HMODULE xcbNvidia;

    xcbCreateWindowType xcbCreateWindow;
    xcbDestroyWindowType xcbDestroyWindow;
    xcbGetMessageType xcbGetMessage;
    xcbPeekMessageType xcbPeekMessage;
    xcbQueuePresentType xcbQueuePresent;
};

// XCB id database.
// FIXME: This is not thread safe.
uint32_t g_xcbId = 0;
struct XcbId {
    xcb_connection_t * connection;
};
std::deque<XcbId> g_xcbIds;

xcb_connection_t * xcb_connect(const char *displayname, int *screenp)
{
    std::string xglNvidia = getenv(DRIVER_PATH_ENV);
    xglNvidia += "\\xgl_nvidia.dll";
    HMODULE module = LoadLibrary(xglNvidia.c_str());
    if (!module) {
        std::string xglNulldrv = getenv("LIBXGL_DRIVERS_PATH");<commit_msg>xcb: Deal with case of getenv() returning NULL.<commit_after>#include <xcb/xcb.h>
#include <xglWsiX11Ext.h>

#include <Windows.h>
#include <string>
#include <deque>

#include <xgl.h>

#include "../loader/loader_platform.h"

typedef void (*xcbCreateWindowType)(uint16_t width, uint16_t height);
typedef void (*xcbDestroyWindowType)();
typedef int (*xcbGetMessageType)(MSG * msg);
typedef BOOL (*xcbPeekMessageType)(MSG * msg);
typedef XGL_RESULT (*xcbQueuePresentType)(XGL_QUEUE queue, XGL_IMAGE image, XGL_FENCE fence);

struct xcb_connection_t {
    xcb_screen_t screens[1];
    xcb_setup_t setup;
    HMODULE xcbNvidia;

    xcbCreateWindowType xcbCreateWindow;
    xcbDestroyWindowType xcbDestroyWindow;
    xcbGetMessageType xcbGetMessage;
    xcbPeekMessageType xcbPeekMessage;
    xcbQueuePresentType xcbQueuePresent;
};

// XCB id database.
// FIXME: This is not thread safe.
uint32_t g_xcbId = 0;
struct XcbId {
    xcb_connection_t * connection;
};
std::deque<XcbId> g_xcbIds;

xcb_connection_t * xcb_connect(const char *displayname, int *screenp)
{
    std::string xglNvidia = (getenv(DRIVER_PATH_ENV) == NULL) ? "" : getenv(DRIVER_PATH_ENV);
    xglNvidia += "\\xgl_nvidia.dll";
    HMODULE module = LoadLibrary(xglNvidia.c_str());
    if (!module) {
        std::string xglNulldrv = (getenv("XGL_DRIVERS_PATH") == NULL) ? "" : getenv("LIBXGL_DRIVERS_PATH");
{'fraction_non_alphanumeric': 0.11760213822069492, 'fraction_numerical': 0.007636502481863307, 'mean_word_length': 5.2829736211031175, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3472544', 'n_tokens_mistral': 1012, 'n_tokens_neox': 965, 'n_words': 198}