diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit 213288009472f899673ded764e2b262786bba6fa
parent d8efe6c42f241d9d0daa34a76dd9ab09b9215392
Author: Matthias Beyer <mail@beyermatthias.de>
Date:   Fri, 18 Nov 2016 14:44:12 +0100

Minify impl of is_leap()

Diffstat:
Mdiary.c | 7+------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/diary.c b/diary.c @@ -81,12 +81,7 @@ bool is_leap(int year) { // normally leap is every 4 years, // but is skipped every 100 years, // unless it is divisible by 400 - if (year % 400 == 0) - return true; - if (year % 4 == 0 && year % 100 != 0) - return true; - - return false; + return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0); } void read_diary(char* dir) {