perf(core): remove all console outputs
This commit is contained in:
parent
f29858361c
commit
0547ef6abb
@ -34,14 +34,12 @@ int sappyou_free(Sappyou *sappyou) {
|
||||
|
||||
int sappyou_load(Sappyou *sappyou) {
|
||||
if (sappyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to load sappyou: input file not specified\n");
|
||||
return 1;
|
||||
}
|
||||
uint16_t signature[4];
|
||||
rewind(sappyou->file);
|
||||
fread(signature, 2, 4, sappyou->file);
|
||||
if (memcmp(signature, SAPPYOU_SIG, 8) != 0) {
|
||||
fprintf(stderr, "Failed to load sappyou: invalid signature\n");
|
||||
return 1;
|
||||
}
|
||||
fread(&sappyou->created_ts, 8, 1, sappyou->file);
|
||||
@ -69,7 +67,6 @@ int sappyou_load(Sappyou *sappyou) {
|
||||
|
||||
int sappyou_save(Sappyou *sappyou) {
|
||||
if (sappyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to save sappyou: output file not specified\n");
|
||||
return 1;
|
||||
}
|
||||
rewind(sappyou->file);
|
||||
@ -99,7 +96,6 @@ int sappyou_save(Sappyou *sappyou) {
|
||||
int sappyou_open(Sappyou *sappyou, const char *path) {
|
||||
sappyou->file = fopen(path, "r+b");
|
||||
if (sappyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to open sappyou: failed to open file '%s'\n", path);
|
||||
return 1;
|
||||
}
|
||||
return sappyou_load(sappyou);
|
||||
@ -108,7 +104,6 @@ int sappyou_open(Sappyou *sappyou, const char *path) {
|
||||
int sappyou_dump(Sappyou *sappyou, const char *path) {
|
||||
sappyou->file = fopen(path, "w+b");
|
||||
if (sappyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to dump sappyou: failed to write to file '%s'\n", path);
|
||||
return 1;
|
||||
}
|
||||
return sappyou_save(sappyou);
|
||||
@ -116,7 +111,6 @@ int sappyou_dump(Sappyou *sappyou, const char *path) {
|
||||
|
||||
int tanzaku_add(Sappyou *sappyou, const char *name, const char *description) {
|
||||
if (sappyou->size == -1 && sappyou->hole_cnt == 0) {
|
||||
fprintf(stderr, "Failed to add tanzaku: sappyou is full\n");
|
||||
return 1;
|
||||
}
|
||||
Tanzaku newbie;
|
||||
@ -148,11 +142,9 @@ int tanzaku_add(Sappyou *sappyou, const char *name, const char *description) {
|
||||
|
||||
int tanzaku_rem(Sappyou *sappyou, uint64_t tanzaku_id) {
|
||||
if (tanzaku_id == HOLE_ID) {
|
||||
fprintf(stderr, "Failed to remove tanzaku: got hole ID\n");
|
||||
return 1;
|
||||
}
|
||||
if (tanzaku_id >= sappyou->size) {
|
||||
fprintf(stderr, "Failed to remove tanzaku: too big ID\n");
|
||||
return 1;
|
||||
}
|
||||
if (sappyou->database[tanzaku_id].id == HOLE_ID) {
|
||||
|
||||
@ -35,14 +35,12 @@ int sasahyou_free(Sasahyou *sasahyou) {
|
||||
|
||||
int sasahyou_load(Sasahyou *sasahyou) {
|
||||
if (sasahyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to load sasahyou: input file not specified\n");
|
||||
return 1;
|
||||
}
|
||||
uint16_t signature[4];
|
||||
rewind(sasahyou->file);
|
||||
fread(signature, 2, 4, sasahyou->file);
|
||||
if (memcmp(signature, SASAHYOU_SIG, 8) != 0) {
|
||||
fprintf(stderr, "Failed to load sasahyou: invalid signature\n");
|
||||
return 1;
|
||||
}
|
||||
fread(&sasahyou->created_ts, 8, 1, sasahyou->file);
|
||||
@ -68,7 +66,6 @@ int sasahyou_load(Sasahyou *sasahyou) {
|
||||
|
||||
int sasahyou_save(Sasahyou *sasahyou) {
|
||||
if (sasahyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to save sasahyou: output file not specified\n");
|
||||
return 1;
|
||||
}
|
||||
rewind(sasahyou->file);
|
||||
@ -95,7 +92,6 @@ int sasahyou_save(Sasahyou *sasahyou) {
|
||||
int sasahyou_open(Sasahyou *sasahyou, const char *path) {
|
||||
sasahyou->file = fopen(path, "r+b");
|
||||
if (sasahyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to open sasahyou: failed to open file '%s'\n", path);
|
||||
return 1;
|
||||
}
|
||||
return sasahyou_load(sasahyou);
|
||||
@ -104,7 +100,6 @@ int sasahyou_open(Sasahyou *sasahyou, const char *path) {
|
||||
int sasahyou_dump(Sasahyou *sasahyou, const char *path) {
|
||||
sasahyou->file = fopen(path, "w+b");
|
||||
if (sasahyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to dump sasahyou: failed to write to file '%s'\n", path);
|
||||
return 1;
|
||||
}
|
||||
return sasahyou_save(sasahyou);
|
||||
@ -112,7 +107,6 @@ int sasahyou_dump(Sasahyou *sasahyou, const char *path) {
|
||||
|
||||
int sasa_add(Sasahyou *sasahyou, const char *path) {
|
||||
if (sasahyou->size == -1 && sasahyou->hole_cnt == 0) {
|
||||
fprintf(stderr, "Failed to add sasa: sasahyou is full\n");
|
||||
return 1;
|
||||
}
|
||||
Sasa newbie;
|
||||
@ -139,11 +133,9 @@ int sasa_add(Sasahyou *sasahyou, const char *path) {
|
||||
|
||||
int sasa_rem(Sasahyou *sasahyou, uint64_t sasa_id) {
|
||||
if (sasa_id == HOLE_ID) {
|
||||
fprintf(stderr, "Failed to remove sasa: got hole ID\n");
|
||||
return 1;
|
||||
}
|
||||
if (sasa_id >= sasahyou->size) {
|
||||
fprintf(stderr, "Failed to remove sasa: too big ID\n");
|
||||
return 1;
|
||||
}
|
||||
if (sasahyou->database[sasa_id].id == HOLE_ID) {
|
||||
|
||||
@ -31,14 +31,12 @@ int shoppyou_free(Shoppyou *shoppyou) {
|
||||
|
||||
int shoppyou_load(Shoppyou *shoppyou) {
|
||||
if (shoppyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to load shoppyou: input file not specified\n");
|
||||
return 1;
|
||||
}
|
||||
uint16_t signature[4];
|
||||
rewind(shoppyou->file);
|
||||
fread(signature, 2, 4, shoppyou->file);
|
||||
if (memcmp(signature, SHOPPYOU_SIG, 8) != 0) {
|
||||
fprintf(stderr, "Failed to load shoppyou: invalid signature\n");
|
||||
return 1;
|
||||
}
|
||||
fread(&shoppyou->created_ts, 8, 1, shoppyou->file);
|
||||
@ -57,7 +55,6 @@ int shoppyou_load(Shoppyou *shoppyou) {
|
||||
|
||||
int shoppyou_save(Shoppyou *shoppyou) {
|
||||
if (shoppyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to save shoppyou: output file not specified\n");
|
||||
return 1;
|
||||
}
|
||||
rewind(shoppyou->file);
|
||||
@ -81,7 +78,6 @@ int shoppyou_save(Shoppyou *shoppyou) {
|
||||
int shoppyou_open(Shoppyou *shoppyou, const char *path) {
|
||||
shoppyou->file = fopen(path, "r+b");
|
||||
if (shoppyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to open shoppyou: failed to open file '%s'\n", path);
|
||||
return 1;
|
||||
}
|
||||
shoppyou->holes = NULL;
|
||||
@ -91,7 +87,6 @@ int shoppyou_open(Shoppyou *shoppyou, const char *path) {
|
||||
int shoppyou_dump(Shoppyou *shoppyou, const char *path) {
|
||||
shoppyou->file = fopen(path, "w+b");
|
||||
if (shoppyou->file == NULL) {
|
||||
fprintf(stderr, "Failed to dump shoppyou: failed to write to file '%s'\n", path);
|
||||
return 1;
|
||||
}
|
||||
return shoppyou_save(shoppyou);
|
||||
@ -99,11 +94,9 @@ int shoppyou_dump(Shoppyou *shoppyou, const char *path) {
|
||||
|
||||
int kazari_add(Shoppyou *shoppyou, uint64_t sasa_id, uint64_t tanzaku_id) {
|
||||
if (sasa_id == HOLE_ID || tanzaku_id == HOLE_ID) {
|
||||
fprintf(stderr, "Failed to add kazari: got hole ID\n");
|
||||
return 1;
|
||||
}
|
||||
if (shoppyou->size == -1 && shoppyou->hole_cnt == 0) {
|
||||
fprintf(stderr, "Failed to add kazari: shoppyou is full\n");
|
||||
return 1;
|
||||
}
|
||||
Kazari newbie;
|
||||
@ -125,7 +118,6 @@ int kazari_add(Shoppyou *shoppyou, uint64_t sasa_id, uint64_t tanzaku_id) {
|
||||
|
||||
int kazari_rem(Shoppyou *shoppyou, uint64_t sasa_id, uint64_t tanzaku_id) {
|
||||
if (sasa_id == HOLE_ID || tanzaku_id == HOLE_ID) {
|
||||
fprintf(stderr, "Failed to remove kazari: got hole ID\n");
|
||||
return 1;
|
||||
}
|
||||
for (uint64_t i = 0; i < shoppyou->size; i++) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user