<commit_before>#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "obstructor.h"

#define LOG(...) fprintf(stderr, __VA_ARGS__)

#define IN_BUFFER_SIZE 8192
#define MAX_S_SIZE 32
#define OUT_BUFFER_SIZE 8192
#define MAX_JSON_SIZE 64

typedef struct in_event {
  char s[MAX_S_SIZE];
  long a,b,sum;
} in_event;

typedef struct out_event {
  char message[MAX_JSON_SIZE];
} out_event;

obstructor *in, *out;
FILE *out_file;

in_event ievents[IN_BUFFER_SIZE];
out_event oevents[OUT_BUFFER_SIZE];

void init_ievent(size_t slot, long n) {
  snprintf(ievents[slot].s, MAX_S_SIZE, "%ld, %ld", n, n * 2);
}

CONSUMER(parse_ievent, slot) {
  char *sep = ", ";
  char *last;
  char *as = strtok_r(ievents[slot].s, sep, &last);
  char *bs = strtok_r(NULL, sep, &last);
  ievents[slot].a = atoll(as);
  ievents[slot].b = atoll(bs);
} END_CONSUMER

CONSUMER(sum_ievent, slot) {
  ievents[slot].sum = ievents[slot].a + ievents[slot].b;
} END_CONSUMER

CONSUMER(jsonify_ievent, slot) {
  size_t slot = get_slot_block(out);
  snprintf(oevents[slot].message, MAX_JSON_SIZE,
           "{\"a\": %ld, \"b\": %ld, \"sum\": %ld}\n",<commit_msg>make strtok_r seperator static<commit_after>#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "obstructor.h"

#define LOG(...) fprintf(stderr, __VA_ARGS__)

#define IN_BUFFER_SIZE 8192
#define MAX_S_SIZE 32
#define OUT_BUFFER_SIZE 8192
#define MAX_JSON_SIZE 64

typedef struct in_event {
  char s[MAX_S_SIZE];
  long a,b,sum;
} in_event;

typedef struct out_event {
  char message[MAX_JSON_SIZE];
} out_event;

obstructor *in, *out;
FILE *out_file;

in_event ievents[IN_BUFFER_SIZE];
out_event oevents[OUT_BUFFER_SIZE];

void init_ievent(size_t slot, long n) {
  snprintf(ievents[slot].s, MAX_S_SIZE, "%ld, %ld", n, n * 2);
}

CONSUMER(parse_ievent, slot) {
  static char *sep = ", ";
  char *last;
  char *as = strtok_r(ievents[slot].s, sep, &last);
  char *bs = strtok_r(NULL, sep, &last);
  ievents[slot].a = atoll(as);
  ievents[slot].b = atoll(bs);
} END_CONSUMER

CONSUMER(sum_ievent, slot) {
  ievents[slot].sum = ievents[slot].a + ievents[slot].b;
} END_CONSUMER

CONSUMER(jsonify_ievent, slot) {
  size_t slot = get_slot_block(out);
  snprintf(oevents[slot].message, MAX_JSON_SIZE,
           "{\"a\": %ld, \"b\": %ld, \"sum\": %ld}\n",
{'fraction_non_alphanumeric': 0.1601005867560771, 'fraction_numerical': 0.010896898575020955, 'mean_word_length': 5.012594458438287, 'pattern_counts': {'":': 6, '<': 13, '<?xml version=': 0, '>': 13, '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': '1926078', 'n_tokens_mistral': 1032, 'n_tokens_neox': 981, 'n_words': 209}