<commit_before>#define PERL_NO_GET_CONTEXT      /* we want efficiency */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"

#include "context.h"

typedef context_t* NGHTTP2__Session;

void handle_options(pTHX_ context_t* context, HV* opt) {
#define getter(name) {\
    SV **svp = hv_fetchs(opt, #name, 0); \
    context->cb.name = svp ? SvREFCNT_inc(*svp) : 0; \
}

    CALLBACK_LIST(getter);
#undef getter
}

static int session_dtor(SV *sv, MAGIC *mg) {
    context_t *ctx = (context_t*) mg->mg_ptr;

#define cleanup(name) SvREFCNT_dec(ctx->cb.name)
    CALLBACK_LIST(cleanup);
#undef cleanup

    context_dtor(ctx);

    return 0;
}

static MGVTBL session_magic_vtbl = { .svt_free = session_dtor };
<commit_msg>Fix magic callback type.<commit_after>#define PERL_NO_GET_CONTEXT      /* we want efficiency */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"

#include "context.h"

typedef context_t* NGHTTP2__Session;

void handle_options(pTHX_ context_t* context, HV* opt) {
#define getter(name) {\
    SV **svp = hv_fetchs(opt, #name, 0); \
    context->cb.name = svp ? SvREFCNT_inc(*svp) : 0; \
}

    CALLBACK_LIST(getter);
#undef getter
}

static int session_dtor(pTHX_ SV *sv, MAGIC *mg) {
    context_t *ctx = (context_t*) mg->mg_ptr;

#define cleanup(name) SvREFCNT_dec(ctx->cb.name)
    CALLBACK_LIST(cleanup);
#undef cleanup

    context_dtor(ctx);

    return 0;
}

static MGVTBL session_magic_vtbl = { .svt_free = session_dtor };

{'fraction_non_alphanumeric': 0.1411371237458194, 'fraction_numerical': 0.005351170568561873, 'mean_word_length': 4.267605633802817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3564015', 'n_tokens_mistral': 622, 'n_tokens_neox': 595, 'n_words': 128}