<commit_before>#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
#include <time.h>
#include <unistd.h>

#include "config.h"

#include "objects.h"
#include "macros.h"
#include "../conf/zsconfig.h"

#ifndef PATH_MAX
# define _LIMITS_H_
# include <sys/syslimits.h>
#endif

struct tm *timenow;
time_t     tnow;

/* Relic from old cleaner.. but it works, so why to change? */
void scandirectory(char *directoryname, int setfree) {
    struct dirent **namelist, **namelist2;
    int m, n, fd;
    printf("[%s]\n", directoryname);
    if ( chdir(directoryname) != -1 ) {
	if ((n = scandir(".", &namelist, 0, 0)) > 0)        
	    while(n--) if ( namelist[n]->d_name[0] != '.' ) {  
		chdir(namelist[n]->d_name);
		if ((m = scandir(".", &namelist2, 0, 0)) > 0) while (m--) if ( namelist2[m]->d_name[0] != '.' ) {
		    if ( (fd = open(namelist2[m]->d_name, O_NDELAY, 0777)) != -1 ) close(fd);
		    else if (setfree) {
			unlink(namelist2[m]->d_name);
			printf("Broken symbolic link \"%s\" removed.\n", namelist2[m]->d_name);
		    }
		}
		chdir("..");
		if (setfree)
			rmdir(namelist[n]->d_name);
	    }
    }
}

char * replace_cookies(char *s) {
    char	*new_string, *pos;

    new_string = pos = malloc(4096);

    while ( *s == '.' || *s == '/' ) s++;

    for ( ; *s ; s++ ) switch ( *s ) {
	case '%':<commit_msg>minor mem-leaks fixed.. still one left (minor).<commit_after>#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
#include <time.h>
#include <unistd.h>

#include "config.h"

#include "objects.h"
#include "macros.h"
#include "../conf/zsconfig.h"

#ifndef PATH_MAX
# define _LIMITS_H_
# include <sys/syslimits.h>
#endif

struct tm *timenow;
time_t     tnow;

/* Relic from old cleaner.. but it works, so why to change? */
void scandirectory(char *directoryname, int setfree) {
    struct dirent **namelist, **namelist2;
    int m, n, fd;
    printf("[%s]\n", directoryname);
    if ( chdir(directoryname) != -1 ) {
	if ((n = scandir(".", &namelist, 0, 0)) > 0)        
	    while(n--) if ( namelist[n]->d_name[0] != '.' ) {  
		chdir(namelist[n]->d_name);
		if ((m = scandir(".", &namelist2, 0, 0)) > 0) while (m--) if ( namelist2[m]->d_name[0] != '.' ) {
		    if ( (fd = open(namelist2[m]->d_name, O_NDELAY, 0777)) != -1 ) close(fd);
		    else if (setfree) {
			unlink(namelist2[m]->d_name);
			printf("Broken symbolic link \"%s\" removed.\n", namelist2[m]->d_name);
		    }
		}
		free(namelist2);
		chdir("..");
		if (setfree)
			rmdir(namelist[n]->d_name);
	    }
	free(namelist);
    }
}

char * replace_cookies(char *s) {
    char	*new_string, *pos;

    new_string = pos = malloc(4096);

    while ( *s == '.' || *s == '/' ) s++;

    for ( ; *s ; s++ ) switch ( *s ) {
	case '%':
{'fraction_non_alphanumeric': 0.21247429746401644, 'fraction_numerical': 0.016792323509252912, 'mean_word_length': 3.17, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 43, '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': '3184905', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1195, 'n_words': 270}