Skip to content
Snippets Groups Projects
Commit d0ca3bf0 authored by Franck Dary's avatar Franck Dary
Browse files

Corrected a bug where array values were used but not set

parent 9c2a3c67
No related branches found
No related tags found
No related merge requests found
...@@ -128,7 +128,6 @@ int look_for_number_of_features(char *filename) ...@@ -128,7 +128,6 @@ int look_for_number_of_features(char *filename)
return max_feat; return max_feat;
} }
int *count_occ_of_features(char *filename, int *n_feat) int *count_occ_of_features(char *filename, int *n_feat)
{ {
char buffer[10000]; char buffer[10000];
...@@ -138,7 +137,8 @@ int *count_occ_of_features(char *filename, int *n_feat) ...@@ -138,7 +137,8 @@ int *count_occ_of_features(char *filename, int *n_feat)
int *occ_table = NULL; int *occ_table = NULL;
*n_feat = look_for_number_of_features(filename); *n_feat = look_for_number_of_features(filename);
occ_table = (int *)memalloc(*n_feat * sizeof(int)); occ_table = (int *)memalloc(*n_feat * sizeof *occ_table);
memset(occ_table, 0, *n_feat * sizeof *occ_table);
while(fgets(buffer, 10000, f)){ while(fgets(buffer, 10000, f)){
buffer[strlen(buffer) - 1] = '\0'; buffer[strlen(buffer) - 1] = '\0';
token = strtok(buffer, "\t"); token = strtok(buffer, "\t");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment