<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

#include "alloc.h"
#include "../main.h"

void *umalloc(size_t s)
{
	void *p = malloc(s);
	if(!p)
		die("umalloc()");
	return p;
}

char *ustrdup(const char *s)
{
	char *d = umalloc(strlen(s) + 1);
	strcpy(d, s);
	return d;
}

void *urealloc(void *p, size_t s)
{
	void *n = realloc(p, s);
	if(!n)
		die("realloc()");
	return n;
}

char *ustrprintf(const char *fmt, ...)
{
	char *s = NULL;
	va_list l;
	int i;

	va_start(l, fmt);
	i = vasprintf(&s, fmt, l);
	va_end(l);

	if(i == -1)
		die("vasprintf()");
	return s;
}

void ustrcat(char **p, int *siz_arg, ...)
{
	int len;
	va_list l;
	const char *s;
	int *siz = siz_arg ? siz_arg : &len;

	len = *p ? strlen(*p) + 1 : 0;

	va_start(l, siz_arg);
	while((s = va_arg(l, const char *)))
		len += strlen(s);
	va_end(l);

	if(*siz <= len){
		/* not enough room */
		*p = realloc(*p, *siz = len + 1);
		if(!*p)
			die("ustrcat()");
	}

	va_start(l, siz_arg);
	while((s = va_arg(l, const char *)))
		strcat(*p, s);
	va_end(l);
}<commit_msg>Fixed uninit memory use<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

#include "alloc.h"
#include "../main.h"

void *umalloc(size_t s)
{
	void *p = malloc(s);
	if(!p)
		die("umalloc()");
	return p;
}

char *ustrdup(const char *s)
{
	char *d = umalloc(strlen(s) + 1);
	strcpy(d, s);
	return d;
}

void *urealloc(void *p, size_t s)
{
	void *n = realloc(p, s);
	if(!n)
		die("realloc()");
	return n;
}

char *ustrprintf(const char *fmt, ...)
{
	char *s = NULL;
	va_list l;
	int i;

	va_start(l, fmt);
	i = vasprintf(&s, fmt, l);
	va_end(l);

	if(i == -1)
		die("vasprintf()");
	return s;
}

void ustrcat(char **p, int *siz_arg, ...)
{
	int len;
	va_list l;
	const char *s;
	int *siz = siz_arg ? siz_arg : &len;

	len = *p ? strlen(*p) + 1 : 0;

	va_start(l, siz_arg);
	while((s = va_arg(l, const char *)))
		len += strlen(s);
	va_end(l);

	if(*siz <= len){
		/* not enough room */
		int nul = !*p;

		*p = realloc(*p, *siz = len + 1);
		if(!*p)
			die("ustrcat()");

		if(nul)
			**p = '\0';
	}

	va_start(l, siz_arg);
	while((s = va_arg(l, const char *)))
		strcat(*p, s);
	va_end(l);
}
{'fraction_non_alphanumeric': 0.22418478260869565, 'fraction_numerical': 0.004981884057971014, 'mean_word_length': 3.4357429718875503, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '5343228', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1056, 'n_words': 253}