<commit_before>//
//  Buffer.c
//  Core
//
//  Created by <NAME> on 1/31/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

#ifndef Core_Buffer_c
#define Core_Buffer_c

#include "Buffer.h"
#include "Pointer.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <string.h>

BufferRef CreateBufferRef() {
	BufferRef buffer = calloc(0x1, sizeof(struct CoreInternalBuffer));
	buffer->data = calloc(0x1, sizeof(char));
	buffer->length = 0x1;
	return buffer;
}

uint64_t IncrementBufferRefBySize(BufferRef buffer, uint64_t size) {
	uint64_t oldSize = buffer->length;
	buffer->length = oldSize+size;
	buffer->data = realloc(buffer->data, buffer->length);
	memset(&(buffer->data[oldSize]), 0x0, size);
	return oldSize;
}

void AppendStringToBuffer(BufferRef buffer, char *append) {
	BufferRef appendBuffer = CreateBufferRef();
	IncrementBufferRefBySize(appendBuffer, strlen(append)-0x1);
	memcpy(appendBuffer->data, append, strlen(append));<commit_msg>fixing cast<commit_after>//
//  Buffer.c
//  Core
//
//  Created by <NAME> on 1/31/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

#ifndef Core_Buffer_c
#define Core_Buffer_c

#include "Buffer.h"
#include "Pointer.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <string.h>

BufferRef CreateBufferRef() {
	BufferRef buffer = calloc(0x1, sizeof(struct CoreInternalBuffer));
	buffer->data = calloc(0x1, sizeof(char));
	buffer->length = 0x1;
	return buffer;
}

uint64_t IncrementBufferRefBySize(BufferRef buffer, uint64_t size) {
	uint64_t oldSize = buffer->length;
	buffer->length = oldSize+size;
	buffer->data = realloc(buffer->data, (unsigned long)buffer->length);
	memset(&(buffer->data[oldSize]), 0x0, size);
	return oldSize;
}

void AppendStringToBuffer(BufferRef buffer, char *append) {
	BufferRef appendBuffer = CreateBufferRef();
	IncrementBufferRefBySize(appendBuffer, strlen(append)-0x1);
	memcpy(appendBuffer->data, append, strlen(append));
{'fraction_non_alphanumeric': 0.15017404276479362, 'fraction_numerical': 0.02486325211337643, 'mean_word_length': 5.387301587301588, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 35, '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': '2521030', 'n_tokens_mistral': 739, 'n_tokens_neox': 718, 'n_words': 157}