blueloveTH il y a 1 an
Parent
commit
2930da4e7f
2 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 1 1
      run_profile.sh
  2. 2 2
      src2/main.c

+ 1 - 1
run_profile.sh

@@ -4,7 +4,7 @@ python prebuild.py
 
 SRC=$(find src/ -name "*.c")
 
-gcc -pg -Og -std=c11 -Wfatal-errors -o main $SRC src2/main.c -Iinclude
+gcc -pg -Og -std=c11 -Wfatal-errors -o main $SRC src2/main.c -Iinclude -lm -DNDEBUG -flto
 ./main benchmarks/fib.py
 gprof main gmon.out > gprof.txt
 rm gmon.out

+ 2 - 2
src2/main.c

@@ -10,7 +10,7 @@
 #endif
 
 char* read_file(const char* path) {
-    FILE* file = fopen(path, "r");
+    FILE* file = fopen(path, "rb");
     if(file == NULL) {
         printf("Error: file not found\n");
         return NULL;
@@ -19,7 +19,7 @@ char* read_file(const char* path) {
     long size = ftell(file);
     fseek(file, 0, SEEK_SET);
     char* buffer = malloc(size + 1);
-    fread(buffer, 1, size, file);
+    size = fread(buffer, 1, size, file);
     buffer[size] = 0;
     return buffer;
 }