diff options
| author | 2020-06-07 21:48:10 -0700 | |
|---|---|---|
| committer | 2020-11-24 01:06:31 +0100 | |
| commit | 9f60cdd76b6044931cc2f2b6f2fbec3deb67a425 (patch) | |
| tree | 66c1a3c42769535966367c3f6f10881da2673f33 /src/time64.c | |
| parent | 2899553df92cd4e10590da73ae7375e5b5517d45 (diff) | |
| download | libplist-9f60cdd76b6044931cc2f2b6f2fbec3deb67a425.tar.gz libplist-9f60cdd76b6044931cc2f2b6f2fbec3deb67a425.tar.bz2 | |
Improve code readability by not using else after return
[clang-tidy] Found with readability-else-after-return
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src/time64.c')
| -rw-r--r-- | src/time64.c | 26 |
1 files changed, 10 insertions, 16 deletions
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) | |||
| 176 | static int cmp_date( const struct TM* left, const struct tm* right ) { | 176 | static int cmp_date( const struct TM* left, const struct tm* right ) { |
| 177 | if( left->tm_year > right->tm_year ) | 177 | if( left->tm_year > right->tm_year ) |
| 178 | return 1; | 178 | return 1; |
| 179 | else if( left->tm_year < right->tm_year ) | 179 | if( left->tm_year < right->tm_year ) |
| 180 | return -1; | 180 | return -1; |
| 181 | |||
| 182 | if( left->tm_mon > right->tm_mon ) | 181 | if( left->tm_mon > right->tm_mon ) |
| 183 | return 1; | 182 | return 1; |
| 184 | else if( left->tm_mon < right->tm_mon ) | 183 | if( left->tm_mon < right->tm_mon ) |
| 185 | return -1; | 184 | return -1; |
| 186 | |||
| 187 | if( left->tm_mday > right->tm_mday ) | 185 | if( left->tm_mday > right->tm_mday ) |
| 188 | return 1; | 186 | return 1; |
| 189 | else if( left->tm_mday < right->tm_mday ) | 187 | if( left->tm_mday < right->tm_mday ) |
| 190 | return -1; | 188 | return -1; |
| 191 | |||
| 192 | if( left->tm_hour > right->tm_hour ) | 189 | if( left->tm_hour > right->tm_hour ) |
| 193 | return 1; | 190 | return 1; |
| 194 | else if( left->tm_hour < right->tm_hour ) | 191 | if( left->tm_hour < right->tm_hour ) |
| 195 | return -1; | 192 | return -1; |
| 196 | |||
| 197 | if( left->tm_min > right->tm_min ) | 193 | if( left->tm_min > right->tm_min ) |
| 198 | return 1; | 194 | return 1; |
| 199 | else if( left->tm_min < right->tm_min ) | 195 | if( left->tm_min < right->tm_min ) |
| 200 | return -1; | 196 | return -1; |
| 201 | |||
| 202 | if( left->tm_sec > right->tm_sec ) | 197 | if( left->tm_sec > right->tm_sec ) |
| 203 | return 1; | 198 | return 1; |
| 204 | else if( left->tm_sec < right->tm_sec ) | 199 | if( left->tm_sec < right->tm_sec ) |
| 205 | return -1; | 200 | return -1; |
| 206 | |||
| 207 | return 0; | 201 | return 0; |
| 208 | } | 202 | } |
| 209 | 203 | ||
| @@ -774,15 +768,15 @@ struct TM *localtime64_r (const Time64_T *timev, struct TM *local_tm) | |||
| 774 | static int valid_tm_wday( const struct TM* date ) { | 768 | static int valid_tm_wday( const struct TM* date ) { |
| 775 | if( 0 <= date->tm_wday && date->tm_wday <= 6 ) | 769 | if( 0 <= date->tm_wday && date->tm_wday <= 6 ) |
| 776 | return 1; | 770 | return 1; |
| 777 | else | 771 | |
| 778 | return 0; | 772 | return 0; |
| 779 | } | 773 | } |
| 780 | 774 | ||
| 781 | static int valid_tm_mon( const struct TM* date ) { | 775 | static int valid_tm_mon( const struct TM* date ) { |
| 782 | if( 0 <= date->tm_mon && date->tm_mon <= 11 ) | 776 | if( 0 <= date->tm_mon && date->tm_mon <= 11 ) |
| 783 | return 1; | 777 | return 1; |
| 784 | else | 778 | |
| 785 | return 0; | 779 | return 0; |
| 786 | } | 780 | } |
| 787 | 781 | ||
| 788 | 782 | ||
