diff --git a/src/Makefile b/src/Makefile index e6ef0b7..4a143b2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,10 +25,10 @@ CFLAGS = -g -O3 -march=corei7 -msse4.2 -pipe -D_GNU_SOURCE -Wall -std=c99 -Wstri export FLAGS CC CFLAGS +all: rtbgen rtbgenp rtbver rtbverp tbcheck + rtbgen rtbgenp rtbver rtbverp tbcheck clean: @$(MAKE) -f Makefile.regular $@ -all: rtbgen rtbgenp rtbver rtbverp tbcheck - .PHONY: rtbgen rtbgenp rtbver rtbverp tbcheck clean diff --git a/src/checksum.c b/src/checksum.c index 12c1aab..528739e 100644 --- a/src/checksum.c +++ b/src/checksum.c @@ -59,7 +59,7 @@ static void calc_checksum(char *name) checksum_found = 1; } else { if (size & 0x3f) { - printf("Size of %s is not a multiple of 64.\n", name); + fprintf(stderr, "Size of %s is not a multiple of 64.\n", name); exit(1); } checksum_found = 0; @@ -84,7 +84,7 @@ void print_checksum(char *name, char *sum) if ((size & 0x3f) == 0x10) { memcpy(checksum1, data + (size & ~0x3fULL), 16); } else { - printf("No checksum found.\n"); + fprintf(stderr, "No checksum found.\n"); exit(1); } unmap_file(data, size); @@ -105,12 +105,12 @@ void add_checksum(char *name) { calc_checksum(name); if (checksum_found) { - printf("%s checksum already present.\n", checksum_match ? "Matching" : "Non-matching"); + fprintf(stderr, "%s checksum already present.\n", checksum_match ? "Matching" : "Non-matching"); exit(1); } FILE *F = fopen(name, "ab"); if (!F) { - printf("Could not open %s for appending.\n", name); + fprintf(stderr, "Could not open %s for appending.\n", name); exit(1); } fwrite(checksum2, 16, 1, F); @@ -122,7 +122,7 @@ void verify_checksum(char *name) printf("%s: ", name); calc_checksum(name); if (!checksum_found) { - printf("No checksum present.\n"); + fprintf(stderr, "No checksum present.\n"); exit(1); } if (!checksum_match) diff --git a/src/compress.c b/src/compress.c index 7a108fb..303878c 100644 --- a/src/compress.c +++ b/src/compress.c @@ -993,7 +993,7 @@ struct HuffCode *construct_pairs_dtz(unsigned char *restrict data, long64 size, pairfreq[i][j] = 0; if (num_syms > 255) { - printf("error\n"); + fprintf(stderr, "error\n"); exit(1); } for (t = 0; t < numthreads; t++) @@ -1107,7 +1107,7 @@ struct HuffCode *construct_pairs_dtz(unsigned char *restrict data, long64 size, } if (i != num) { - printf("Ran short of symbols.\n"); + printf("Ran short of symbols.\n"); // not an error num = i; num_ctrl--; } @@ -1738,7 +1738,7 @@ void compress_tb(struct tb_handle *F, ubyte *restrict data, strcat(name, F->wdl ? WDLSUFFIX : DTZSUFFIX); strcat(name, ext); if (!(G = fopen(name, "wb"))) { - printf("Could not open %s for writing.\n", name); + fprintf(stderr, "Could not open %s for writing.\n", name); exit(1); } @@ -1760,7 +1760,7 @@ void merge_tb(struct tb_handle *F) strcpy(name, F->name); strcat(name, F->wdl ? WDLSUFFIX : DTZSUFFIX); if (!(G = fopen(name, "wb"))) { - printf("Could not open %s for writing.\n", name); + fprintf(stderr, "Could not open %s for writing.\n", name); exit(1); } @@ -1771,7 +1771,7 @@ void merge_tb(struct tb_handle *F) strcat(name, F->wdl ? WDLSUFFIX : DTZSUFFIX); strcat(name, ext); if (!(F->H[i] = fopen(name, "rb"))) { - printf("Could not open %s for reading.\n", name); + fprintf(stderr, "Could not open %s for reading.\n", name); exit(1); } } diff --git a/src/decompress.c b/src/decompress.c index 950f226..27a986f 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -273,7 +273,7 @@ void decomp_init_table(struct tb_handle *H) magic = 0; fread(&magic, 1, 4, F); if (magic != (H->wdl ? WDL_MAGIC : DTZ_MAGIC)) { - printf("Corrupted table.\n"); + fprintf(stderr, "Corrupted table.\n"); exit(1); } @@ -468,7 +468,7 @@ static void decompress_worker(struct thread_data *thread) while (idx + size > idx2) { if (*((uint32 *)(d->indextable + 6 * mainidx)) != block || *((ushort *)(d->indextable + 6 * mainidx + 4)) != idx2 - idx) { - printf("ERROR in main index!!\n"); + fprintf(stderr, "ERROR in main index!!\n"); exit(1); } idx2 += 1ULL << d->idxbits; @@ -536,7 +536,7 @@ struct tb_handle *open_tb(char *tablename, int wdl) strcat(name, tablename); strcat(name, wdl ? WDLSUFFIX : DTZSUFFIX); if (!(H->F = fopen(name, "rb"))) { - printf("Could not open %s for reading.\n", name); + fprintf(stderr, "Could not open %s for reading.\n", name); exit(1); } H->data = (ubyte *)map_file(name, 1, &(H->data_size)); diff --git a/src/permute.c b/src/permute.c index 1e94d8f..5e9ca36 100644 --- a/src/permute.c +++ b/src/permute.c @@ -1000,7 +1000,7 @@ ubyte *init_permute_piece(int *pcs, int *pt, ubyte *tb_table) generate_test_list(tb_size, entry_piece.num); if (!tb_table && !(tb_table = malloc(tb_size + 1))) { - printf("Out of memory.\n"); + fprintf(stderr, "Out of memory.\n"); exit(1); } @@ -1193,7 +1193,7 @@ ubyte *init_permute_file(int *pcs, int file, ubyte *tb_table) generate_test_list(tb_size, entry_pawn.num); if (!tb_table && !(tb_table = malloc(tb_size + 1))) { - printf("Out of memory.\n"); + fprintf(stderr, "Out of memory.\n"); exit(1); } diff --git a/src/probe.c b/src/probe.c index 0a2dc1d..a7bff60 100644 --- a/src/probe.c +++ b/src/probe.c @@ -116,7 +116,7 @@ void add_to_hash(struct TBEntry *ptr, long64 key) while (i < HSHMAX && TB_hash[hshidx][i].ptr) i++; if (i == HSHMAX) { - printf("HSHMAX too low!\n"); + fprintf(stderr, "HSHMAX too low!\n"); exit(1); } else { TB_hash[hshidx][i].key = key; @@ -180,13 +180,13 @@ static void init_tb(char *str) } if (pcs[WPAWN] + pcs[BPAWN] == 0) { if (TBnum_piece == TBMAX_PIECE) { - printf("TBMAX_PIECE limit too low!\n"); + fprintf(stderr, "TBMAX_PIECE limit too low!\n"); exit(1); } entry = (struct TBEntry *)&TB_piece[TBnum_piece++]; } else { if (TBnum_pawn == TBMAX_PAWN) { - printf("TBMAX_PAWN limit too low!\n"); + fprintf(stderr, "TBMAX_PAWN limit too low!\n"); exit(1); } entry = (struct TBEntry *)&TB_pawn[TBnum_pawn++]; @@ -2126,7 +2126,7 @@ static void init_table(struct TBEntry *entry, long64 key) entry->data = map_file(file, 1, &dummy); ubyte *data = (ubyte *)entry->data; if (((uint32 *)data)[0] != WDL_MAGIC) { - printf("Corrupted table.\n"); + fprintf(stderr, "Corrupted table.\n"); exit(1); } @@ -3030,7 +3030,7 @@ static __attribute__ ((noinline)) void probe_failed(int *pieces) if (pieces[j] == BKING - i) str[k++] = pchr[i]; str[k] = 0; - printf("Missing table: %s\n", str); + fprintf(stderr, "Missing table: %s\n", str); exit(1); } diff --git a/src/reduce.c b/src/reduce.c index af7672f..6cac980 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -20,16 +20,16 @@ void save_table(ubyte *table, char color) if (!lz4_buf) { lz4_buf = malloc(4 + LZ4_compressBound(COPYSIZE)); if (!lz4_buf) { - printf("Out of memory.\n"); - exit(0); + fprintf(stderr, "Out of memory.\n"); + exit(1); } } sprintf(name, "%s.%c.%d", tablename, color, num_saves); if (!(F = fopen(name, "wb"))) { - printf("Could not open %s for writing.\n", name); - exit(-1); + fprintf(stderr, "Could not open %s for writing.\n", name); + exit(1); } for (i = 0; i < 256; i++) @@ -99,8 +99,8 @@ void reconstruct_table_pass(ubyte *table, char color, int k, ubyte *v) sprintf(name, "%s.%c.%d", tablename, color, k); if (!(F = fopen(name, "rb"))) { - printf("Could not open %s for writing.\n", name); - exit(-1); + fprintf(stderr, "Could not open %s for writing.\n", name); + exit(1); } ubyte *ptr = table; @@ -185,8 +185,10 @@ void verify_stats(ubyte *table, long64 *tot_stats, struct dtz_map *map) verify_ok = 0; } - if (!verify_ok) + if (!verify_ok) { + fprintf(stderr, "Verification of reconstructed table failed.\n"); exit(1); + } } void reconstruct_table(ubyte *table, char color, struct dtz_map *map) @@ -413,16 +415,16 @@ void store_table(ubyte *table, char color) if (!lz4_buf) { lz4_buf = malloc(4 + LZ4_compressBound(COPYSIZE)); if (!lz4_buf) { - printf("Out of memory.\n"); - exit(0); + fprintf(stderr, "Out of memory.\n"); + exit(1); } } sprintf(name, "%s.%c", tablename, color); if (!(F = fopen(name, "wb"))) { - printf("Could not open %s for writing.\n", name); - exit(-1); + fprintf(stderr, "Could not open %s for writing.\n", name); + exit(1); } ubyte *ptr = table; @@ -448,8 +450,8 @@ void load_table(ubyte *table, char color) sprintf(name, "%s.%c", tablename, color); if (!(F = fopen(name, "rb"))) { - printf("Could not open %s for writing.\n", name); - exit(-1); + fprintf(stderr, "Could not open %s for writing.\n", name); + exit(1); } ubyte *ptr = table; diff --git a/src/reducep.c b/src/reducep.c index f21d462..4684a58 100644 --- a/src/reducep.c +++ b/src/reducep.c @@ -29,16 +29,16 @@ void save_table(ubyte *table, char color, int local, long64 begin, long64 size) if (!lz4_buf) { lz4_buf = malloc(8 + LZ4_compressBound(COPYSIZE)); if (!lz4_buf) { - printf("Out of memory.\n"); - exit(0); + fprintf(stderr, "Out of memory.\n"); + exit(1); } } if (local == num_saves) { sprintf(name, "%s.%c.%d", tablename, color, num_saves); if (!(F = fopen(name, "wb"))) { - printf("Could not open %s for writing.\n", name); - exit(-1); + fprintf(stderr, "Could not open %s for writing.\n", name); + exit(1); } tmp_table[num_saves][color == 'w' ? 0 : 1] = F; } else { @@ -113,8 +113,8 @@ void reconstruct_table_pass(ubyte *table, char color, int k, ubyte *v) sprintf(name, "%s.%c.%d", tablename, color, k); if (!(F = fopen(name, "rb"))) { - printf("Could not open %s for writing.\n", name); - exit(-1); + fprintf(stderr, "Could not open %s for writing.\n", name); + exit(1); } ubyte *ptr = table; @@ -184,8 +184,10 @@ void verify_stats(ubyte *table, long64 *tot_stats, struct dtz_map *map) verify_ok = 0; } - if (!verify_ok) + if (!verify_ok) { + fprintf(stderr, "Verification of reconstructed table failed.\n"); exit(1); + } } void reconstruct_table(ubyte *table, char color, struct dtz_map *map) @@ -441,16 +443,16 @@ void store_table(ubyte *table, char color) if (!lz4_buf) { lz4_buf = malloc(8 + LZ4_compressBound(COPYSIZE)); if (!lz4_buf) { - printf("Out of memory.\n"); - exit(0); + fprintf(stderr, "Out of memory.\n"); + exit(1); } } sprintf(name, "%s.%c", tablename, color); if (!(F = fopen(name, "wb"))) { - printf("Could not open %s for writing.\n", name); - exit(-1); + fprintf(stderr, "Could not open %s for writing.\n", name); + exit(1); } ubyte *ptr = table; @@ -476,8 +478,8 @@ void load_table(ubyte *table, char color) sprintf(name, "%s.%c", tablename, color); if (!(F = fopen(name, "rb"))) { - printf("Could not open %s for writing.\n", name); - exit(-1); + fprintf(stderr, "Could not open %s for writing.\n", name); + exit(1); } ubyte *ptr = table; diff --git a/src/rtbver.c b/src/rtbver.c index 1ac1e60..6f336aa 100644 --- a/src/rtbver.c +++ b/src/rtbver.c @@ -823,7 +823,7 @@ void load_wdl(struct thread_data *thread) if (unlikely(v2 > 4)) table[idx_p] = WDL_ERROR; else table[idx_p] = wdl_matrix[v2][v1_p]; if(unlikely(table[idx_p]==WDL_ERROR)) -printf("WDL_ERROR: idx = %"PRIu64", v2 = %d, v1 = %d\n", idx_p, v2, v1_p); +error("WDL_ERROR: idx = %"PRIu64", v2 = %d, v1 = %d\n", idx_p, v2, v1_p); v1_p = v1; idx_p = idx; idx2_p = idx2; @@ -833,7 +833,7 @@ printf("WDL_ERROR: idx = %"PRIu64", v2 = %d, v1 = %d\n", idx_p, v2, v1_p); if (unlikely(v2 > 4)) table[idx_p] = WDL_ERROR; else table[idx_p] = wdl_matrix[v2][v1_p]; if(unlikely(table[idx_p]==WDL_ERROR)) -printf("WDL_ERROR: idx = %"PRIu64", v2 = %d, v1 = %d\n", idx_p, v2, v1_p); +error("WDL_ERROR: idx = %"PRIu64", v2 = %d, v1 = %d\n", idx_p, v2, v1_p); } #else void load_wdl(struct thread_data *thread) @@ -1094,7 +1094,7 @@ void wdl_load_wdl(struct thread_data *thread) if (unlikely(v2 > 4)) table[idx] = W_ERROR; else table[idx] = w_wdl_matrix[v2][v1]; if(unlikely(table[idx]==W_ERROR)) -printf("W_ERROR: idx = %"PRIu64", v2 = %d, v1 = %d\n", idx, v2, v1); +error("W_ERROR: idx = %"PRIu64", v2 = %d, v1 = %d\n", idx, v2, v1); } } diff --git a/src/stats.c b/src/stats.c index 8e3c432..83c5095 100644 --- a/src/stats.c +++ b/src/stats.c @@ -81,7 +81,7 @@ static long64 find_val(ubyte *table, ubyte v) run_threaded(find_loop, work_g, 0); if (found_idx == 0xffffffffffffffffULL) - printf("find_val: not found!\n"); + fprintf(stderr, "find_val: not found!\n"); return found_idx; } diff --git a/src/statsp.c b/src/statsp.c index ab93eef..c46494b 100644 --- a/src/statsp.c +++ b/src/statsp.c @@ -83,7 +83,7 @@ long64 find_val(ubyte *table, ubyte v, long64 *work) run_threaded(find_loop, work, 0); if (found_idx == 0xffffffffffffffffULL) - printf("find_val: not found!\n"); + fprintf(stderr, "find_val: not found!\n"); return found_idx; } diff --git a/src/tbcheck.c b/src/tbcheck.c index c8010f2..629ae10 100644 --- a/src/tbcheck.c +++ b/src/tbcheck.c @@ -18,18 +18,18 @@ static void compare_checksums(char *file) FILE *F = fopen(file, "r"); if (!F) { - printf("Could not open %s.\n", file); + fprintf(stderr, "Could not open %s.\n", file); return; } while (!feof(F)) { int num = fscanf(F, "%100[KQRBNP|v|rtbwz|.]: %32[0-9|a-f]\n", name, sum); if (num != 2 || strlen(sum) != 32) { - printf("Could not completely parse %s.\n", file); + fprintf(stderr, "Could not completely parse %s.\n", file); break; } FILE *G = fopen(name, "rb"); if (!G) { - printf("Tablebase file %s not found.\n", name); + fprintf(stderr, "Tablebase file %s not found.\n", name); } else { fclose(G); print_checksum(name, sum2); @@ -74,7 +74,7 @@ int main(int argc, char **argv) } while (val != EOF); if (optind >= argc) { - printf("No tablebase specified.\n"); + fprintf(stderr, "No tablebase specified.\n"); exit(0); } diff --git a/src/tbgen.c b/src/tbgen.c index a7955ec..0cc1927 100644 --- a/src/tbgen.c +++ b/src/tbgen.c @@ -568,8 +568,8 @@ int main(int argc, char **argv) } while (val != EOF); if (optind >= argc) { - printf("No tablebase specified.\n"); - exit(0); + fprintf(stderr, "No tablebase specified.\n"); + exit(1); } tablename = argv[optind]; @@ -618,23 +618,23 @@ int main(int argc, char **argv) #ifndef SUICIDE if (pcs[WKING] != 1 || pcs[BKING] != 1) { - printf("Need one white king and one black king.\n"); + fprintf(stderr, "Need one white king and one black king.\n"); exit(1); } if (numpcs < 3) { - printf("Need at least 3 pieces.\n"); + fprintf(stderr, "Need at least 3 pieces.\n"); exit(1); } #else if (numpcs < 2) { - printf("Need at least 2 pieces.\n"); + fprintf(stderr, "Need at least 2 pieces.\n"); exit(1); } #endif if (pcs[WPAWN] || pcs[BPAWN]) { - printf("Can't handle pawns.\n"); + fprintf(stderr, "Can't handle pawns.\n"); exit(1); } diff --git a/src/tbgenp.c b/src/tbgenp.c index 3228017..042b1eb 100644 --- a/src/tbgenp.c +++ b/src/tbgenp.c @@ -672,8 +672,8 @@ int main(int argc, char **argv) } while (val != EOF); if (optind >= argc) { - printf("No tablebase specified.\n"); - exit(0); + fprintf(stderr, "No tablebase specified.\n"); + exit(1); } tablename = argv[optind]; @@ -726,23 +726,23 @@ int main(int argc, char **argv) #ifndef SUICIDE if (pcs[WKING] != 1 || pcs[BKING] != 1) { - printf("Need one white king and one black king.\n"); + fprintf(stderr, "Need one white king and one black king.\n"); exit(1); } if (numpcs < 3) { - printf("Need at least 3 pawns or pieces.\n"); + fprintf(stderr, "Need at least 3 pawns or pieces.\n"); exit(1); } #else if (numpcs < 2) { - printf("Need at least 2 pawns or pieces.\n"); + fprintf(stderr, "Need at least 2 pawns or pieces.\n"); exit(1); } #endif if (numpawns == 0) { - printf("Expecting pawns.\n"); + fprintf(stderr, "Expecting pawns.\n"); exit(1); } diff --git a/src/tbver.c b/src/tbver.c index 35aa6b2..6477106 100644 --- a/src/tbver.c +++ b/src/tbver.c @@ -162,8 +162,8 @@ int main(int argc, char **argv) } while (val != EOF); if (optind >= argc) { - printf("No tablebase specified.\n"); - exit(0); + fprintf(stderr, "No tablebase specified.\n"); + exit(1); } tablename = argv[optind]; @@ -211,7 +211,7 @@ int main(int argc, char **argv) if (!color) exit(1); if (pcs[WPAWN] || pcs[BPAWN]) { - printf("Can't handle pawns.\n"); + fprintf(stderr, "Can't handle pawns.\n"); exit(1); } diff --git a/src/tbverp.c b/src/tbverp.c index f964af1..979820d 100644 --- a/src/tbverp.c +++ b/src/tbverp.c @@ -240,8 +240,8 @@ int main(int argc, char **argv) } while (val != EOF); if (optind >= argc) { - printf("No tablebase specified.\n"); - exit(0); + fprintf(stderr, "No tablebase specified.\n"); + exit(1); } tablename = argv[optind]; @@ -310,7 +310,7 @@ int main(int argc, char **argv) } if (numpawns == 0) { - printf("Expecting pawns.\n"); + fprintf(stderr, "Expecting pawns.\n"); exit(1); } @@ -325,7 +325,7 @@ int main(int argc, char **argv) symmetric = (i == 8); if (symmetric) { - printf("Can't handle symmetric tables.\n"); + fprintf(stderr, "Can't handle symmetric tables.\n"); exit(1); } diff --git a/src/threads.c b/src/threads.c index d8d2dc2..0339ad4 100644 --- a/src/threads.c +++ b/src/threads.c @@ -142,7 +142,7 @@ void init_threads(int pawns) int rc = pthread_create(&threads[i], NULL, worker, (void *)&(thread_data[i])); if (rc) { - printf("ERROR: pthread_create() returned %d\n", rc); + fprintf(stderr, "ERROR: pthread_create() returned %d\n", rc); exit(1); } } @@ -151,7 +151,7 @@ void init_threads(int pawns) start_event[i] = CreateEvent(NULL, FALSE, FALSE, NULL); stop_event[i] = CreateEvent(NULL, FALSE, FALSE, NULL); if (!start_event[i] || !stop_event[i]) { - printf("CreateEvent() failed.\n"); + fprintf(stderr, "CreateEvent() failed.\n"); exit(1); } } @@ -159,7 +159,7 @@ void init_threads(int pawns) threads[i] = CreateThread(NULL, 0, worker, (void *)&(thread_data[i]), 0, NULL); if (threads[i] == NULL) { - printf("CreateThread() failed.\n"); + fprintf(stderr, "CreateThread() failed.\n"); exit(1); } } diff --git a/src/util.c b/src/util.c index 8d2284a..77e339b 100644 --- a/src/util.c +++ b/src/util.c @@ -20,7 +20,7 @@ char *map_file(char *name, int shared, long64 *size) struct stat statbuf; int fd = open(name, O_RDONLY); if (fd < 0) { - printf("Could not open %s for reading.\n", name); + fprintf(stderr, "Could not open %s for reading.\n", name); exit(1); } fstat(fd, &statbuf); @@ -32,7 +32,7 @@ char *map_file(char *name, int shared, long64 *size) char *data = (char *)mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0); #endif if (data == (char *)(-1)) { - printf("Could not mmap() %s.\n", name); + fprintf(stderr, "Could not mmap() %s.\n", name); exit(1); } close(fd); @@ -41,7 +41,7 @@ char *map_file(char *name, int shared, long64 *size) HANDLE h = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) { - printf("Could not open %s for reading.\n", name); + fprintf(stderr, "Could not open %s for reading.\n", name); exit(1); } DWORD size_low, size_high; @@ -50,12 +50,12 @@ char *map_file(char *name, int shared, long64 *size) HANDLE map = CreateFileMapping(h, NULL, PAGE_READONLY, size_high, size_low, NULL); if (map == NULL) { - printf("CreateFileMapping() failed.\n"); + fprintf(stderr, "CreateFileMapping() failed.\n"); exit(1); } char *data = (char *)MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0); if (data == NULL) { - printf("MapViewOfFile() failed.\n"); + fprintf(stderr, "MapViewOfFile() failed.\n"); exit(1); } CloseHandle(h); @@ -79,7 +79,7 @@ ubyte *alloc_aligned(long64 size, uintptr_t alignment) posix_memalign((void **)&ptr, alignment, size); if (ptr == NULL) { - printf("Could not allocate sufficient memory.\n"); + fprintf(stderr, "Could not allocate sufficient memory.\n"); exit(1); } @@ -89,7 +89,7 @@ ubyte *alloc_aligned(long64 size, uintptr_t alignment) ptr = malloc(size + alignment - 1); if (ptr == NULL) { - printf("Could not allocate sufficient memory.\n"); + fprintf(stderr, "Could not allocate sufficient memory.\n"); exit(1); } ptr = (ubyte *)((uintptr_t)(ptr + alignment - 1) & ~(alignment - 1)); @@ -105,7 +105,7 @@ ubyte *alloc_huge(long64 size) posix_memalign((void **)&ptr, 2 * 1024 * 1024, size); if (ptr == NULL) { - printf("Could not allocate sufficient memory.\n"); + fprintf(stderr, "Could not allocate sufficient memory.\n"); exit(1); } #ifdef __linux__ @@ -118,7 +118,7 @@ ubyte *alloc_huge(long64 size) ptr = malloc(size); if (ptr == NULL) { - printf("Could not allocate sufficient memory.\n"); + fprintf(stderr, "Could not allocate sufficient memory.\n"); exit(1); }