From 2d46b72929139dffdca63dd18b5e2578fe474b6b Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Thu, 29 Dec 2022 18:04:34 +0300 Subject: [PATCH] style(core): code cleanup --- core/sappyou.c | 5 +---- core/sasahyou.c | 5 +---- core/shoppyou.c | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/core/sappyou.c b/core/sappyou.c index 7ee2db3..578ede3 100644 --- a/core/sappyou.c +++ b/core/sappyou.c @@ -152,10 +152,7 @@ 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) { - return 1; - } - if (tanzaku_id >= sappyou->size) { + if (tanzaku_id == HOLE_ID || tanzaku_id >= sappyou->size) { return 1; } if (sappyou->database[tanzaku_id].id == HOLE_ID) { diff --git a/core/sasahyou.c b/core/sasahyou.c index 93da39b..eb6d3ab 100644 --- a/core/sasahyou.c +++ b/core/sasahyou.c @@ -146,10 +146,7 @@ int sasa_add(Sasahyou *sasahyou, const char *path) { } int sasa_rem(Sasahyou *sasahyou, uint64_t sasa_id) { - if (sasa_id == HOLE_ID) { - return 1; - } - if (sasa_id >= sasahyou->size) { + if (sasa_id == HOLE_ID || sasa_id >= sasahyou->size) { return 1; } if (sasahyou->database[sasa_id].id == HOLE_ID) { diff --git a/core/shoppyou.c b/core/shoppyou.c index 6d72da2..75cfa4b 100644 --- a/core/shoppyou.c +++ b/core/shoppyou.c @@ -104,10 +104,7 @@ 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) { - return 1; - } - if (shoppyou->size == -1 && shoppyou->hole_cnt == 0) { + if (sasa_id == HOLE_ID || tanzaku_id == HOLE_ID || shoppyou->size == -1 && shoppyou->hole_cnt == 0) { return 1; } Kazari newbie;