Skip to content

Commit

Permalink
cleanup tailing white spaces with clean.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
idealvin committed Jul 1, 2020
1 parent 39ccf57 commit 8843ffa
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 24 deletions.
4 changes: 3 additions & 1 deletion src/_clean.sh → clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ fi

cd "$(dirname "$0")"

src=`ls *.{h,cc} */*.{h,cc,cpp} */*/*.{h,cc}`
incdir="include/co"
srcdir=
src=`ls include/co/*.h include/co/*/*.h */*.cc */*/*.{h,cc,cpp} */*/*/*.{h,cc,cpp}`

for x in $src
do
Expand Down
10 changes: 5 additions & 5 deletions include/co/__/dtoa_milo.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2014 Milo Yip
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -59,7 +59,7 @@ struct DiyFp {
if (biased_e != 0) {
f = significand + kDpHiddenBit;
e = biased_e - kDpExponentBias;
}
}
else {
f = significand;
e = kDpMinExponent + 1;
Expand Down Expand Up @@ -276,7 +276,7 @@ inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buff
case 3: d = p1 / 100; p1 %= 100; break;
case 2: d = p1 / 10; p1 %= 10; break;
case 1: d = p1; p1 = 0; break;
default:
default:
#if defined(_MSC_VER)
__assume(0);
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
Expand Down
2 changes: 1 addition & 1 deletion include/co/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class Value {
void reset() {
if (!_mem) return;
this->_UnRef();
_mem = 0;
_mem = 0;
}

private:
Expand Down
7 changes: 1 addition & 6 deletions include/co/win/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

//extern "C" {
//__int64 _InterlockedCompareExchange64(__int64 volatile* Destination, __int64 Exchange, __int64 Comperand);
//#pragma intrinsic(_InterlockedCompareExchange64)
//}

#ifdef InterlockedIncrement64
#define _InterlockedIncrement64 InterlockedIncrement64
#define _InterlockedIncrement64 InterlockedIncrement64
#endif
#ifdef InterlockedDecrement64
#define _InterlockedDecrement64 InterlockedDecrement64
Expand Down
12 changes: 6 additions & 6 deletions src/co/impl/hook.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ kevent_fp_t fp_kevent = 0;
/*
* From man-pages socket(7): (man 7 socket)
* SO_RCVTIMEO and SO_SNDTIMEO
* Specify the receiving or sending timeouts until reporting an error. The
* argument is a struct timeval. If an input or output function blocks for
* this period of time, and data has been sent or received, the return value
* of that function will be the amount of data transferred; if no data has
* been transferred and the timeout has been reached, then -1 is returned
* with errno set to EAGAIN or EWOULDBLOCK, or EINPROGRESS (for connect(2))
* Specify the receiving or sending timeouts until reporting an error. The
* argument is a struct timeval. If an input or output function blocks for
* this period of time, and data has been sent or received, the return value
* of that function will be the amount of data transferred; if no data has
* been transferred and the timeout has been reached, then -1 is returned
* with errno set to EAGAIN or EWOULDBLOCK, or EINPROGRESS (for connect(2))
* just as if the socket was specified to be nonblocking.
*/
int connect(int fd, const struct sockaddr* addr, socklen_t addrlen) {
Expand Down
8 changes: 4 additions & 4 deletions src/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ const char* read_unicode(const char* b, const char* e, fastream& fs) {
}
}

if (unlikely(u < 0xdc00 || u > 0xdfff)) return 0;
if (unlikely(u < 0xdc00 || u > 0xdfff)) return 0;
v = 0x10000 + ((v & 0x3ff) << 10) + (u & 0x3ff);
}

Expand Down Expand Up @@ -502,11 +502,11 @@ int64 fastatoi(const char* s, size_t n) {
if (unlikely(s[i] < '0' || s[i] > '9')) throw 0;

if (n < 20) return v * 10 + s[i] - '0';

if (n == 20) {
if (v > (MAX_UINT64 - (s[i] - '0')) / 10) throw 0;
return v * 10 + s[i] - '0';
}
}

throw 0; // n > 20

Expand All @@ -527,7 +527,7 @@ int64 fastatoi(const char* s, size_t n) {
if (n == 19) {
if (v > (static_cast<uint64>(MIN_INT64) - (s[i] - '0')) / 10) throw 0;
return -static_cast<int64>(v * 10 + s[i] - '0');
}
}

throw 0; // n > 19
}
Expand Down
2 changes: 1 addition & 1 deletion src/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void LevelLogger::stop() {
}
}

// Try to call only async-signal-safe api in this function according to:
// Try to call only async-signal-safe api in this function according to:
// http://man7.org/linux/man-pages/man7/signal-safety.7.html
void LevelLogger::safe_stop() {
if (atomic_compare_swap(&_stop, 0, 1) != 0) return;
Expand Down

0 comments on commit 8843ffa

Please sign in to comment.