<commit_before>#include <X11/Xlib.h>

#include "../get.h"
#include "../list.h"
#include "../remote.h"
#include "./glpack.h"
#include "./remote.h"
#include "gl_helpers.h"

void remote_local_pre(ring_t *ring, packed_call_t *call) {
    switch (call->index) {
        case glXCreateContext_INDEX:
        {
            glXCreateContext_PACKED *n = (glXCreateContext_PACKED *)call;
            ring_write(ring, n->args.vis, sizeof(XVisualInfo));
            if (n->args.shareList) {
                ring_write(ring, n->args.shareList, sizeof(GLXContext));
            }
            break;
        }
        case glXMakeCurrent_INDEX:
            // if the window create hasn't flushed yet, we can't init on the remote
            XFlush(((glXMakeCurrent_PACKED *)call)->args.dpy);
            break;
        case glDeleteTextures_INDEX:
        {
            glDeleteTextures_PACKED *n = (glDeleteTextures_PACKED *)call;
            ring_write(ring, n->args.textures, n->args.n * sizeof(GLuint));
            break;
        }
        case glTexImage2D_INDEX:
        {
            glTexImage2D_PACKED *n = (glTexImage2D_PACKED *)call;
            if (n->args.pixels) {
                size_t size = n->args.width * n->args.height * gl_pixel_sizeof(n->args.format, n->args.type);
                ring_write(ring, n->args.pixels, size);
            }
            break;
        }
        case glTexSubImage2D_INDEX:
        {
            glTexSubImage2D_PACKED *n = (glTexSubImage2D_PACKED *)call;
            if (n->args.pixels) {
                size_t size = n->args.width * n->args.height * gl_pixel_sizeof(n->args.format, n->args.type);
                ring_write(ring, n->args.pixels, size);
            }
            break;
        }
        case glLoadMatrixf_INDEX:
        case glLoadTransposeMatrixf_INDEX:
        case glMultMatrixf_INDEX:
        case glMultTransposeMatrixf_INDEX:

        {<commit_msg>don't XFlush null display on remote<commit_after>#include <X11/Xlib.h>

#include "../get.h"
#include "../list.h"
#include "../remote.h"
#include "./glpack.h"
#include "./remote.h"
#include "gl_helpers.h"

void remote_local_pre(ring_t *ring, packed_call_t *call) {
    switch (call->index) {
        case glXCreateContext_INDEX:
        {
            glXCreateContext_PACKED *n = (glXCreateContext_PACKED *)call;
            ring_write(ring, n->args.vis, sizeof(XVisualInfo));
            if (n->args.shareList) {
                ring_write(ring, n->args.shareList, sizeof(GLXContext));
            }
            break;
        }
        case glXMakeCurrent_INDEX:
        {
            Display *dpy = ((glXMakeCurrent_PACKED *)call)->args.dpy;
            // if the window create hasn't flushed yet, we can't init on the remote
            if (dpy) {
                XFlush(dpy);
            }
            break;
        }
        case glDeleteTextures_INDEX:
        {
            glDeleteTextures_PACKED *n = (glDeleteTextures_PACKED *)call;
            ring_write(ring, n->args.textures, n->args.n * sizeof(GLuint));
            break;
        }
        case glTexImage2D_INDEX:
        {
            glTexImage2D_PACKED *n = (glTexImage2D_PACKED *)call;
            if (n->args.pixels) {
                size_t size = n->args.width * n->args.height * gl_pixel_sizeof(n->args.format, n->args.type);
                ring_write(ring, n->args.pixels, size);
            }
            break;
        }
        case glTexSubImage2D_INDEX:
        {
            glTexSubImage2D_PACKED *n = (glTexSubImage2D_PACKED *)call;
            if (n->args.pixels) {
                size_t size = n->args.width * n->args.height * gl_pixel_sizeof(n->args.format, n->args.type);
                ring_write(ring, n->args.pixels, size);
            }
            break;
        }
        case glLoadMatrixf_INDEX:
        case glLoadTransposeMatrixf_INDEX:
        case glMultMatrixf_INDEX:
        case glMultTransposeMatrixf_INDEX:

        {
{'fraction_non_alphanumeric': 0.11836423672847346, 'fraction_numerical': 0.004064008128016256, 'mean_word_length': 1.8453757225433527, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, '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': '3908376', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1250, 'n_words': 228}