<commit_before>#include <string.h>
#include <errno.h>
#include <ctype.h>

#include "plugin.h"
#include "log.h"
#include "response.h"
#include "file_cache_funcs.h"

typedef struct {
	/* unparsed pieces */
	buffer *path_pieces_raw;
	
	/* pieces for path creation */
	size_t len;
	buffer **path_pieces;
} plugin_config;

typedef struct {
	PLUGIN_DATA;
	buffer *tmp_buf;

	plugin_config **config_storage;
	plugin_config conf; 
} plugin_data;

INIT_FUNC(mod_evhost_init) {
	plugin_data *p;
	
	p = calloc(1, sizeof(*p));
	
	p->tmp_buf = buffer_init();

	return p;
}

FREE_FUNC(mod_evhost_free) {
	plugin_data *p = p_d;
	
	UNUSED(srv);

	if (!p) return HANDLER_GO_ON;
	
	if (p->config_storage) {
		size_t i;
		for (i = 0; i < srv->config_context->used; i++) {
			plugin_config *s = p->config_storage[i];
			
			if(s->path_pieces) {
				for (i = 0; i < s->len; i++) {
					buffer_free(s->path_pieces[i]);
				}
				
				free(s->path_pieces);
			}
			
			buffer_free(s->path_pieces_raw);
			
			free(s);
		}<commit_msg>fixed usage of the same loop-var in nested loops<commit_after>#include <string.h>
#include <errno.h>
#include <ctype.h>

#include "plugin.h"
#include "log.h"
#include "response.h"
#include "file_cache_funcs.h"

typedef struct {
	/* unparsed pieces */
	buffer *path_pieces_raw;
	
	/* pieces for path creation */
	size_t len;
	buffer **path_pieces;
} plugin_config;

typedef struct {
	PLUGIN_DATA;
	buffer *tmp_buf;

	plugin_config **config_storage;
	plugin_config conf; 
} plugin_data;

INIT_FUNC(mod_evhost_init) {
	plugin_data *p;
	
	p = calloc(1, sizeof(*p));
	
	p->tmp_buf = buffer_init();

	return p;
}

FREE_FUNC(mod_evhost_free) {
	plugin_data *p = p_d;
	
	UNUSED(srv);

	if (!p) return HANDLER_GO_ON;
	
	if (p->config_storage) {
		size_t i;
		for (i = 0; i < srv->config_context->used; i++) {
			plugin_config *s = p->config_storage[i];

			if (!s) continue;
			
			if(s->path_pieces) {
				size_t j;
				for (j = 0; j < s->len; j++) {
					buffer_free(s->path_pieces[j]);
				}
				
				free(s->path_pieces);
			}
			
			buffer_free(s->path_pieces_raw);
			
			free(s);
		}
{'fraction_non_alphanumeric': 0.15303682448589193, 'fraction_numerical': 0.0028694404591104736, 'mean_word_length': 3.537960954446855, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 29, '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': '1498741', 'n_tokens_mistral': 980, 'n_tokens_neox': 844, 'n_words': 177}