From cbd858544db7aa8307c4d686194df6cc814832af Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 28 May 2019 13:48:06 +0200 Subject: [PATCH] LibC: Move struct timeval to sys/time.h. #POSIX --- AK/Time.h | 6 ++++-- LibC/sys/time.h | 6 ++++++ LibC/sys/types.h | 5 ----- LibCore/CElapsedTimer.h | 2 +- LibCore/CEventLoop.h | 3 ++- LibCore/CIODevice.cpp | 5 +++-- Ports/.port_include.sh | 1 + Servers/LookupServer/main.cpp | 22 +++++++++++----------- Userland/tc.cpp | 13 +++++++------ Userland/uc.cpp | 13 +++++++------ 10 files changed, 42 insertions(+), 34 deletions(-) diff --git a/AK/Time.h b/AK/Time.h index 3839f18f17..cab8ec54ba 100644 --- a/AK/Time.h +++ b/AK/Time.h @@ -2,7 +2,8 @@ namespace AK { -inline void timeval_sub(const struct timeval* a, const struct timeval* b, struct timeval* result) +template +inline void timeval_sub(const TimevalType* a, const TimevalType* b, TimevalType* result) { result->tv_sec = a->tv_sec - b->tv_sec; result->tv_usec = a->tv_usec - b->tv_usec; @@ -12,7 +13,8 @@ inline void timeval_sub(const struct timeval* a, const struct timeval* b, struct } } -inline void timeval_add(const struct timeval* a, const struct timeval* b, struct timeval* result) +template +inline void timeval_add(const TimevalType* a, const TimevalType* b, TimevalType* result) { result->tv_sec = a->tv_sec + b->tv_sec; result->tv_usec = a->tv_usec + b->tv_usec; diff --git a/LibC/sys/time.h b/LibC/sys/time.h index 9d93686923..fef0236f82 100644 --- a/LibC/sys/time.h +++ b/LibC/sys/time.h @@ -1,9 +1,15 @@ #pragma once #include +#include __BEGIN_DECLS +struct timeval { + time_t tv_sec; + suseconds_t tv_usec; +}; + struct timezone { int tz_minuteswest; int tz_dsttime; diff --git a/LibC/sys/types.h b/LibC/sys/types.h index 7cb759328a..dc55ad488e 100644 --- a/LibC/sys/types.h +++ b/LibC/sys/types.h @@ -37,11 +37,6 @@ typedef uint32_t clock_t; #define __socklen_t uint32_t typedef __socklen_t socklen_t; -struct timeval { - time_t tv_sec; - suseconds_t tv_usec; -}; - struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ diff --git a/LibCore/CElapsedTimer.h b/LibCore/CElapsedTimer.h index b7aa84bfee..bb8fa28ac6 100644 --- a/LibCore/CElapsedTimer.h +++ b/LibCore/CElapsedTimer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include class CElapsedTimer { public: diff --git a/LibCore/CEventLoop.h b/LibCore/CEventLoop.h index 31a0d21a48..a44cc72486 100644 --- a/LibCore/CEventLoop.h +++ b/LibCore/CEventLoop.h @@ -1,12 +1,13 @@ #pragma once -#include #include #include #include #include #include +#include #include +#include #include class CEvent; diff --git a/LibCore/CIODevice.cpp b/LibCore/CIODevice.cpp index c4a5437aeb..bf1fdb68b2 100644 --- a/LibCore/CIODevice.cpp +++ b/LibCore/CIODevice.cpp @@ -1,7 +1,8 @@ #include -#include -#include #include +#include +#include +#include #include CIODevice::CIODevice(CObject* parent) diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index 1a5de96130..50f3f7ca3b 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -35,6 +35,7 @@ function run_fetch_git() { if [ -d "$PORT_DIR/.git" ]; then run_command git fetch run_command git reset --hard FETCH_HEAD + run_command git clean -fx else run_command_nocd git clone "$1" "$PORT_DIR" fi diff --git a/Servers/LookupServer/main.cpp b/Servers/LookupServer/main.cpp index 2deaf273ea..11e2ab49d0 100644 --- a/Servers/LookupServer/main.cpp +++ b/Servers/LookupServer/main.cpp @@ -1,19 +1,19 @@ +#include "DNSPacket.h" +#include "DNSRecord.h" +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include +#include #include -#include -#include -#include -#include -#include -#include -#include "DNSPacket.h" -#include "DNSRecord.h" -#include #define T_A 1 #define T_NS 2 diff --git a/Userland/tc.cpp b/Userland/tc.cpp index 374d61474c..b19aa2a98e 100644 --- a/Userland/tc.cpp +++ b/Userland/tc.cpp @@ -1,11 +1,12 @@ -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include int main(int argc, char** argv) { diff --git a/Userland/uc.cpp b/Userland/uc.cpp index 672854d12e..c5aabda29d 100644 --- a/Userland/uc.cpp +++ b/Userland/uc.cpp @@ -1,11 +1,12 @@ -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include int main(int argc, char** argv) {