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

#include "term.h"

#define BUFFER_SIZE_MAX 16
#define SUCCESS 0
#define FAILURE -1

/* if s1 starts with s2 returns 1, else 0 */
static int starts_with(const char *s1, const char *s2)
{
	/* nice huh? */
	while (*s2) if (*s1++ != *s2++) return 0; return 1;
}

/* convert escape sequence to event, and return consumed bytes on success (failure == 0) */
static int parse_escape_seq(struct tb_event *event, const char *buf)
{
	/* it's pretty simple here, find 'starts_with' match and return success, else return failure */
	int i;
	for (i = 0; keys[i]; i++) {
		if (starts_with(buf, keys[i])) {
			event->ch = 0;
			event->key = 0xFFFF-i;
			return strlen(keys[i]);
		}
	}
	return 0;
}
<commit_msg>SUCCESS/FAILURE are no longer needed due to stdbool.h.<commit_after>#include <assert.h>
#include <stdio.h>
#include <string.h>

#include "term.h"

#define BUFFER_SIZE_MAX 16

/* if s1 starts with s2 returns 1, else 0 */
static int starts_with(const char *s1, const char *s2)
{
	/* nice huh? */
	while (*s2) if (*s1++ != *s2++) return 0; return 1;
}

/* convert escape sequence to event, and return consumed bytes on success (failure == 0) */
static int parse_escape_seq(struct tb_event *event, const char *buf)
{
	/* it's pretty simple here, find 'starts_with' match and return success, else return failure */
	int i;
	for (i = 0; keys[i]; i++) {
		if (starts_with(buf, keys[i])) {
			event->ch = 0;
			event->key = 0xFFFF-i;
			return strlen(keys[i]);
		}
	}
	return 0;
}

{'fraction_non_alphanumeric': 0.1504539559014267, 'fraction_numerical': 0.02464332036316472, 'mean_word_length': 3.821875, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1396101', 'n_tokens_mistral': 609, 'n_tokens_neox': 563, 'n_words': 195}