<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <alloca.h>
#include <inttypes.h>
#include "utils.h"


char *region_format = "%[^:]:%"SCNu32"-%"SCNu32"";

int check_exist(char *fname){
	FILE *fp;
	if((fp = fopen(fname,"r"))){
		fclose(fp);
		return 1;
	}
	return 0;
}

int parse_file_name( char *dir, char *fname, const char *file){
  char *tmp = alloca(sizeof(char) * strlen(file)+1);
  memset(dir,0,sizeof(dir));
  memset(fname,0,sizeof(fname));
  strcpy(tmp, file);
  int total_l = 0;
  if(strncmp(tmp,"./",2)==0){
    tmp = &tmp[2];
    total_l += 2;
  }
  char *ssc;
  int l = 0;

  ssc = strstr(tmp, "/");
  while(ssc){
    l = strlen(ssc) + 1;
    total_l += strlen(tmp)-l+2;
    tmp = &tmp[strlen(tmp)-l+2];
    ssc = strstr(tmp, "/");
  };

  fname = strcpy(fname,&file[total_l]);
  dir = strcat(dir,"");
  if(total_l){
    dir = strncat(dir,file,total_l);
  }
  strcat(fname,"\0");
  strcat(dir,"\0");
  return 1;
}

void print_version (int exit_code){
  printf ("%s\n",VERSION);
	exit(exit_code);
}

int line_count (char *file_path){
  FILE *f = fopen(file_path,"r");
  int line_count = 0;
  check(f != NULL, "Error opening file '%s' to count lines.",file_path);
  char rd[ 5000 ];
	while(fgets(rd, sizeof(rd), f) != NULL){
    line_count++;
  }
  fclose(f);
  return line_count;
error:
  if(f) fclose(f);
  return -1;
}

int parseRegionString(char *region, char *contig, uint32_t *start, uint32_t *stop){
  int check_parse = sscanf(region,region_format,contig,start,stop);
  if(check_parse != 3) return 0;
  return check_parse;
}<commit_msg>memset removed<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <alloca.h>
#include <inttypes.h>
#include "utils.h"


char *region_format = "%[^:]:%"SCNu32"-%"SCNu32"";

int check_exist(char *fname){
	FILE *fp;
	if((fp = fopen(fname,"r"))){
		fclose(fp);
		return 1;
	}
	return 0;
}

int parse_file_name( char *dir, char *fname, const char *file){
  char *tmp = alloca(sizeof(char) * strlen(file)+1);
  strcpy(tmp, file);
  int total_l = 0;
  if(strncmp(tmp,"./",2)==0){
    tmp = &tmp[2];
    total_l += 2;
  }
  char *ssc;
  int l = 0;

  ssc = strstr(tmp, "/");
  while(ssc){
    l = strlen(ssc) + 1;
    total_l += strlen(tmp)-l+2;
    tmp = &tmp[strlen(tmp)-l+2];
    ssc = strstr(tmp, "/");
  };

  fname = strcpy(fname,&file[total_l]);
  dir = strcat(dir,"");
  if(total_l){
    dir = strncat(dir,file,total_l);
  }
  strcat(fname,"\0");
  strcat(dir,"\0");
  return 1;
}

void print_version (int exit_code){
  printf ("%s\n",VERSION);
	exit(exit_code);
}

int line_count (char *file_path){
  FILE *f = fopen(file_path,"r");
  int line_count = 0;
  check(f != NULL, "Error opening file '%s' to count lines.",file_path);
  char rd[ 5000 ];
	while(fgets(rd, sizeof(rd), f) != NULL){
    line_count++;
  }
  fclose(f);
  return line_count;
error:
  if(f) fclose(f);
  return -1;
}

int parseRegionString(char *region, char *contig, uint32_t *start, uint32_t *stop){
  int check_parse = sscanf(region,region_format,contig,start,stop);
  if(check_parse != 3) return 0;
  return check_parse;
}
{'fraction_non_alphanumeric': 0.19785226163358283, 'fraction_numerical': 0.02082655385616661, 'mean_word_length': 4.072607260726072, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3561647', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1301, 'n_words': 275}