From b5712a1bc148fd069561716f3ac86d2cadfb41b4 Mon Sep 17 00:00:00 2001 From: Thomas Jahns <jahns@dkrz.de> Date: Fri, 15 Jun 2018 11:46:10 +0200 Subject: [PATCH] Inline trivial function. --- include/mtime_datetime.h | 9 +++++++-- src/mtime_datetime.c | 20 -------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/include/mtime_datetime.h b/include/mtime_datetime.h index be10d886..37dff6e0 100644 --- a/include/mtime_datetime.h +++ b/include/mtime_datetime.h @@ -71,8 +71,13 @@ int getNoOfDaysInYearDateTime(struct _datetime* dt); /*! \cond PRIVATE */ -bool -testYearIsLeapYear(int64_t year); +static inline bool +testYearIsLeapYear(int64_t year) +{ + bool isLeapYear = !(year % 400) || ((year % 100) && !(year % 4)); + return isLeapYear; +} + struct _datetime * convertDateToDateTime(struct _date* d, struct _datetime* dt_return); diff --git a/src/mtime_datetime.c b/src/mtime_datetime.c index cc71bc09..1fc55971 100644 --- a/src/mtime_datetime.c +++ b/src/mtime_datetime.c @@ -336,26 +336,6 @@ else } -/*! \cond PRIVATE */ -/* Internal function. Test is year a leap year? */ - -bool -testYearIsLeapYear(int64_t year) -{ - bool flag = false; - - if (!(year % 400)) - flag = true; - else if (!(year % 100)) - flag = false; - else if (!(year % 4)) - flag = true; - else - flag = false; - - return flag; -} - /* * NOTE: Internal and not doxyfied. * -- GitLab