From 9f60cdd76b6044931cc2f2b6f2fbec3deb67a425 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 7 Jun 2020 21:48:10 -0700 Subject: Improve code readability by not using else after return [clang-tidy] Found with readability-else-after-return Signed-off-by: Rosen Penev --- src/time64.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src/time64.c') diff --git a/src/time64.c b/src/time64.c index db571d8..364e159 100644 --- a/src/time64.c +++ b/src/time64.c @@ -176,34 +176,28 @@ static int is_exception_century(Year year) static int cmp_date( const struct TM* left, const struct tm* right ) { if( left->tm_year > right->tm_year ) return 1; - else if( left->tm_year < right->tm_year ) + if( left->tm_year < right->tm_year ) return -1; - if( left->tm_mon > right->tm_mon ) return 1; - else if( left->tm_mon < right->tm_mon ) + if( left->tm_mon < right->tm_mon ) return -1; - if( left->tm_mday > right->tm_mday ) return 1; - else if( left->tm_mday < right->tm_mday ) + if( left->tm_mday < right->tm_mday ) return -1; - if( left->tm_hour > right->tm_hour ) return 1; - else if( left->tm_hour < right->tm_hour ) + if( left->tm_hour < right->tm_hour ) return -1; - if( left->tm_min > right->tm_min ) return 1; - else if( left->tm_min < right->tm_min ) + if( left->tm_min < right->tm_min ) return -1; - if( left->tm_sec > right->tm_sec ) return 1; - else if( left->tm_sec < right->tm_sec ) + if( left->tm_sec < right->tm_sec ) return -1; - return 0; } @@ -774,15 +768,15 @@ struct TM *localtime64_r (const Time64_T *timev, struct TM *local_tm) static int valid_tm_wday( const struct TM* date ) { if( 0 <= date->tm_wday && date->tm_wday <= 6 ) return 1; - else - return 0; + + return 0; } static int valid_tm_mon( const struct TM* date ) { if( 0 <= date->tm_mon && date->tm_mon <= 11 ) return 1; - else - return 0; + + return 0; } -- cgit v1.1-32-gdbae