[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 3/4] lib/uktime: Fix checkpath errors for timegm


  • To: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Wed, 11 Sep 2019 13:56:04 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3BE89aXRNbUON7f9CfUgdWSHNvZ2GiGV6/84z7qRXUY=; b=DLHDAkSVqCXEIT2zpGOOkBQ9XQ4Ba2fsPvDKw9Gq9EwO66qCnNH4I+++iUAORngNjYsuM9abfbUfDRgZkpuUr05iqefHSG9oNUQf0NPzqd7GEkgGPHBlW6CWOjPp2nFX7lcxaoZMdr5tgvCf65XZcOaTjkoZArMHkRfCTVIXDLfIKzylfDelK6bRr15iGPpmxIklHhCxSgdfmlDiMnwYZFwQdNXrZm57ej2uVcev8AYAfsXEa7mJMX6y4rUTA128+Xu8O+yxSByZmk6w68Hqp0kWCH/psRLz0itQX94GDbAu0tJwJfqAAF+CJDognSAOSjm+krQH3XqXiDHMnZ9W7w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mS3rHQDpti2N9279nf9IHO4tgnROgD6dHcCvuGy7LsaMIAJw31UZZSl/Akqnb3kJDRnNGa4dZEw2qaEo7DFtmbTJkK9c/i3VRUbE2zmVPStditG3AT0hYlOIGWOt7Rwm5NYU+RQjNd0SMqqdt7vruoNCnPKG6bYliOIVV3vpRG5ulvEQlLHBjC9QmBWLb2ljYmIkQXWI/npheONToiJ3AooDvJFZWyNrzpVimsag8iCo30geUptV+jnuAMn08EmKfUqYvX9+Z5ElFf/E2sbWo0wZYEY4TvGzu8p8dn62ekBxwQk6Cez1oVXauRw/iwYTe6/n6347VbDP2Um0m4oCbA==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>, "costin.lupu@xxxxxxxxx" <costin.lupu@xxxxxxxxx>
  • Delivery-date: Wed, 11 Sep 2019 13:56:28 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVaKinzt3G4V4bXUaLbEt+Iegc5g==
  • Thread-topic: [UNIKRAFT PATCH 3/4] lib/uktime: Fix checkpath errors for timegm

We fix the checkpath errors of the imported files. We omit the
"function definition argument * should also have an identifier name"
warnings since the functions are commented out.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 .../musl-imported/include/uktime/time.h       | 58 +++++++++----------
 .../musl-imported/src/__month_to_secs.c       |  4 +-
 lib/uktime/musl-imported/src/__secs_to_tm.c   |  4 +-
 lib/uktime/musl-imported/src/__tm_to_secs.c   |  3 +
 lib/uktime/musl-imported/src/__year_to_secs.c | 22 ++++---
 lib/uktime/musl-imported/src/timegm.c         |  1 +
 6 files changed, 53 insertions(+), 39 deletions(-)

diff --git a/lib/uktime/musl-imported/include/uktime/time.h 
b/lib/uktime/musl-imported/include/uktime/time.h
index b64560ab..30a02f98 100644
--- a/lib/uktime/musl-imported/include/uktime/time.h
+++ b/lib/uktime/musl-imported/include/uktime/time.h
@@ -15,7 +15,7 @@ extern "C" {
 #ifdef __cplusplus
 #define NULL 0L
 #else
-#define NULL ((void*)0)
+#define NULL ((void *)0)
 #endif
 #endif
 
@@ -62,15 +62,15 @@ struct tm {
 };
 
 #if 0
-clock_t clock (void);
-time_t time (time_t *);
-double difftime (time_t, time_t);
-time_t mktime (struct tm *);
-size_t strftime (char *__restrict, size_t, const char *__restrict, const 
struct tm *__restrict);
-struct tm *gmtime (const time_t *);
-struct tm *localtime (const time_t *);
-char *asctime (const struct tm *);
-char *ctime (const time_t *);
+clock_t clock(void);
+time_t time(time_t *);
+double difftime(time_t, time_t);
+time_t mktime(struct tm *);
+size_t strftime(char *__restrict, size_t, const char *__restrict, const struct 
tm *__restrict);
+struct tm *gmtime(const time_t *);
+struct tm *localtime(const time_t *);
+char *asctime(const struct tm *);
+char *ctime(const time_t *);
 int timespec_get(struct timespec *, int);
 #endif
 
@@ -83,14 +83,14 @@ int timespec_get(struct timespec *, int);
  || defined(_BSD_SOURCE)
 
 #if 0
-size_t strftime_l (char *  __restrict, size_t, const char *  __restrict, const 
struct tm *  __restrict, locale_t);
+size_t strftime_l(char *__restrict, size_t, const char *__restrict, const 
struct tm *__restrict, locale_t);
 
-struct tm *gmtime_r (const time_t *__restrict, struct tm *__restrict);
-struct tm *localtime_r (const time_t *__restrict, struct tm *__restrict);
-char *asctime_r (const struct tm *__restrict, char *__restrict);
-char *ctime_r (const time_t *, char *);
+struct tm *gmtime_r(const time_t *__restrict, struct tm *__restrict);
+struct tm *localtime_r(const time_t *__restrict, struct tm *__restrict);
+char *asctime_r(const struct tm *__restrict, char *__restrict);
+char *ctime_r(const time_t *, char *);
 
-void tzset (void);
+void tzset(void);
 #endif
 
 struct itimerspec {
@@ -113,22 +113,22 @@ struct itimerspec {
 
 #define TIMER_ABSTIME 1
 
-int nanosleep (const struct timespec *, struct timespec *);
+int nanosleep(const struct timespec *, struct timespec *);
 #if 0
-int clock_getres (clockid_t, struct timespec *);
+int clock_getres(clockid_t, struct timespec *);
 #endif
-int clock_gettime (clockid_t, struct timespec *);
+int clock_gettime(clockid_t, struct timespec *);
 #if 0
-int clock_settime (clockid_t, const struct timespec *);
-int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec 
*);
-int clock_getcpuclockid (pid_t, clockid_t *);
+int clock_settime(clockid_t, const struct timespec *);
+int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec 
*);
+int clock_getcpuclockid(pid_t, clockid_t *);
 
 struct sigevent;
-int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict);
-int timer_delete (timer_t);
-int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct 
itimerspec *__restrict);
-int timer_gettime (timer_t, struct itimerspec *);
-int timer_getoverrun (timer_t);
+int timer_create(clockid_t, struct sigevent *__restrict, timer_t *__restrict);
+int timer_delete(timer_t);
+int timer_settime(timer_t, int, const struct itimerspec *__restrict, struct 
itimerspec *__restrict);
+int timer_gettime(timer_t, struct itimerspec *);
+int timer_getoverrun(timer_t);
 
 extern char *tzname[2];
 #endif
@@ -136,11 +136,11 @@ extern char *tzname[2];
 
 #if 0
 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
-char *strptime (const char *__restrict, const char *__restrict, struct tm 
*__restrict);
+char *strptime(const char *__restrict, const char *__restrict, struct tm 
*__restrict);
 extern int daylight;
 extern long timezone;
 extern int getdate_err;
-struct tm *getdate (const char *);
+struct tm *getdate(const char *);
 #endif
 #endif
 
diff --git a/lib/uktime/musl-imported/src/__month_to_secs.c 
b/lib/uktime/musl-imported/src/__month_to_secs.c
index 43248fb3..c3ae57f3 100644
--- a/lib/uktime/musl-imported/src/__month_to_secs.c
+++ b/lib/uktime/musl-imported/src/__month_to_secs.c
@@ -5,6 +5,8 @@ int __month_to_secs(int month, int is_leap)
                120*86400, 151*86400, 181*86400, 212*86400,
                243*86400, 273*86400, 304*86400, 334*86400 };
        int t = secs_through_month[month];
-       if (is_leap && month >= 2) t+=86400;
+
+       if (is_leap && month >= 2)
+               t += 86400;
        return t;
 }
diff --git a/lib/uktime/musl-imported/src/__secs_to_tm.c 
b/lib/uktime/musl-imported/src/__secs_to_tm.c
index 093d9021..4a9f53a3 100644
--- a/lib/uktime/musl-imported/src/__secs_to_tm.c
+++ b/lib/uktime/musl-imported/src/__secs_to_tm.c
@@ -15,7 +15,7 @@ int __secs_to_tm(long long t, struct tm *tm)
        int qc_cycles, c_cycles, q_cycles;
        int months;
        int wday, yday, leap;
-       static const char days_in_month[] = 
{31,30,31,30,31,31,30,31,30,31,31,29};
+       static const char days_in_month[] = {31, 30, 31, 30, 31, 31, 30, 31, 
30, 31, 31, 29};
 
        /* Reject time_t values whose year would overflow int */
        if (t < INT_MIN * 31622400LL || t > INT_MAX * 31622400LL)
@@ -57,7 +57,7 @@ int __secs_to_tm(long long t, struct tm *tm)
 
        years = remyears + 4*q_cycles + 100*c_cycles + 400LL*qc_cycles;
 
-       for (months=0; days_in_month[months] <= remdays; months++)
+       for (months = 0; days_in_month[months] <= remdays; months++)
                remdays -= days_in_month[months];
 
        if (months >= 10) {
diff --git a/lib/uktime/musl-imported/src/__tm_to_secs.c 
b/lib/uktime/musl-imported/src/__tm_to_secs.c
index c29fa985..aaf7d13c 100644
--- a/lib/uktime/musl-imported/src/__tm_to_secs.c
+++ b/lib/uktime/musl-imported/src/__tm_to_secs.c
@@ -5,8 +5,10 @@ long long __tm_to_secs(const struct tm *tm)
        int is_leap;
        long long year = tm->tm_year;
        int month = tm->tm_mon;
+
        if (month >= 12 || month < 0) {
                int adj = month / 12;
+
                month %= 12;
                if (month < 0) {
                        adj--;
@@ -15,6 +17,7 @@ long long __tm_to_secs(const struct tm *tm)
                year += adj;
        }
        long long t = __year_to_secs(year, &is_leap);
+
        t += __month_to_secs(month, is_leap);
        t += 86400LL * (tm->tm_mday-1);
        t += 3600LL * tm->tm_hour;
diff --git a/lib/uktime/musl-imported/src/__year_to_secs.c 
b/lib/uktime/musl-imported/src/__year_to_secs.c
index 2824ec6d..16d71c55 100644
--- a/lib/uktime/musl-imported/src/__year_to_secs.c
+++ b/lib/uktime/musl-imported/src/__year_to_secs.c
@@ -3,16 +3,20 @@ long long __year_to_secs(long long year, int *is_leap)
        if (year-2ULL <= 136) {
                int y = year;
                int leaps = (y-68)>>2;
+
                if (!((y-68)&3)) {
                        leaps--;
-                       if (is_leap) *is_leap = 1;
-               } else if (is_leap) *is_leap = 0;
+                       if (is_leap)
+                               *is_leap = 1;
+               } else if (is_leap)
+                       *is_leap = 0;
                return 31536000*(y-70) + 86400*leaps;
        }
 
        int cycles, centuries, leaps, rem;
 
-       if (!is_leap) is_leap = &(int){0};
+       if (!is_leap)
+               is_leap = &(int){0};
        cycles = (year-100) / 400;
        rem = (year-100) % 400;
        if (rem < 0) {
@@ -25,11 +29,15 @@ long long __year_to_secs(long long year, int *is_leap)
                leaps = 0;
        } else {
                if (rem >= 200) {
-                       if (rem >= 300) centuries = 3, rem -= 300;
-                       else centuries = 2, rem -= 200;
+                       if (rem >= 300)
+                               centuries = 3, rem -= 300;
+                       else
+                               centuries = 2, rem -= 200;
                } else {
-                       if (rem >= 100) centuries = 1, rem -= 100;
-                       else centuries = 0;
+                       if (rem >= 100)
+                               centuries = 1, rem -= 100;
+                       else
+                               centuries = 0;
                }
                if (!rem) {
                        *is_leap = 0;
diff --git a/lib/uktime/musl-imported/src/timegm.c 
b/lib/uktime/musl-imported/src/timegm.c
index 80e2506d..bde40b90 100644
--- a/lib/uktime/musl-imported/src/timegm.c
+++ b/lib/uktime/musl-imported/src/timegm.c
@@ -8,6 +8,7 @@ time_t timegm(struct tm *tm)
 {
        struct tm new;
        long long t = __tm_to_secs(tm);
+
        if (__secs_to_tm(t, &new) < 0) {
                errno = EOVERFLOW;
                return -1;
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.