some valgrind de-noising
fix subtle typo in sub_of (David Sirovsky)
This commit is contained in:
parent
87dea7fb2d
commit
a8a5e9a3d5
1
CHANGES
1
CHANGES
@ -1,5 +1,6 @@
|
|||||||
0.28:
|
0.28:
|
||||||
add uint64 pack and unpack routines
|
add uint64 pack and unpack routines
|
||||||
|
fix subtle typo in sub_of (David Sirovsky)
|
||||||
|
|
||||||
0.27:
|
0.27:
|
||||||
add fmt_strm
|
add fmt_strm
|
||||||
|
@ -26,6 +26,7 @@ void io_dontwantread(int64 d) {
|
|||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
if (io_waitmode==EPOLL) {
|
if (io_waitmode==EPOLL) {
|
||||||
struct epoll_event x;
|
struct epoll_event x;
|
||||||
|
byte_zero(&x,sizeof(x)); // to shut up valgrind
|
||||||
x.events=0;
|
x.events=0;
|
||||||
if (e->wantwrite) x.events|=EPOLLOUT;
|
if (e->wantwrite) x.events|=EPOLLOUT;
|
||||||
x.data.fd=d;
|
x.data.fd=d;
|
||||||
|
@ -26,6 +26,7 @@ void io_dontwantwrite(int64 d) {
|
|||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
if (io_waitmode==EPOLL) {
|
if (io_waitmode==EPOLL) {
|
||||||
struct epoll_event x;
|
struct epoll_event x;
|
||||||
|
byte_zero(&x,sizeof(x)); // to shut up valgrind
|
||||||
x.events=0;
|
x.events=0;
|
||||||
if (e->wantread) x.events|=EPOLLIN;
|
if (e->wantread) x.events|=EPOLLIN;
|
||||||
x.data.fd=d;
|
x.data.fd=d;
|
||||||
|
@ -32,6 +32,7 @@ void io_wantread(int64 d) {
|
|||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
if (io_waitmode==EPOLL) {
|
if (io_waitmode==EPOLL) {
|
||||||
struct epoll_event x;
|
struct epoll_event x;
|
||||||
|
byte_zero(&x,sizeof(x)); // to shut up valgrind
|
||||||
x.events=EPOLLIN;
|
x.events=EPOLLIN;
|
||||||
if (e->wantwrite) x.events|=EPOLLOUT;
|
if (e->wantwrite) x.events|=EPOLLOUT;
|
||||||
x.data.fd=d;
|
x.data.fd=d;
|
||||||
|
@ -29,6 +29,7 @@ void io_wantwrite(int64 d) {
|
|||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
if (io_waitmode==EPOLL) {
|
if (io_waitmode==EPOLL) {
|
||||||
struct epoll_event x;
|
struct epoll_event x;
|
||||||
|
byte_zero(&x,sizeof(x)); // to shut up valgrind
|
||||||
x.events=EPOLLOUT;
|
x.events=EPOLLOUT;
|
||||||
if (e->wantread) x.events|=EPOLLIN;
|
if (e->wantread) x.events|=EPOLLIN;
|
||||||
x.data.fd=d;
|
x.data.fd=d;
|
||||||
|
@ -106,7 +106,7 @@ int range_str4inbuf(const void* buf,size_t len,const void* stringstart);
|
|||||||
* return 0. Otherwise, return 1. */
|
* return 0. Otherwise, return 1. */
|
||||||
#define add_of(c,a,b) ({ typeof(a) __a=a; typeof(b) __b=b; (__b)<1?((__MIN(typeof(c))-(__b)<=(__a))?assign(c,__a+__b):1) : ((__MAX(typeof(c))-(__b)>=(__a))?assign(c,__a+__b):1); })
|
#define add_of(c,a,b) ({ typeof(a) __a=a; typeof(b) __b=b; (__b)<1?((__MIN(typeof(c))-(__b)<=(__a))?assign(c,__a+__b):1) : ((__MAX(typeof(c))-(__b)>=(__a))?assign(c,__a+__b):1); })
|
||||||
|
|
||||||
#define sub_of(c,a,b) ({ typeof(a) __a=a; typeof(b) __b=b; (__b)<1?((__MAX(typeof(c))-(__b)>=(__a))?assign(c,__a-__b):1) : ((__MIN(typeof(c))+(__b)<=(__a))?assign(c,__a-__b):1); })
|
#define sub_of(c,a,b) ({ typeof(a) __a=a; typeof(b) __b=b; (__b)<1?((__MAX(typeof(c))+(__b)>=(__a))?assign(c,__a-__b):1) : ((__MIN(typeof(c))+(__b)<=(__a))?assign(c,__a-__b):1); })
|
||||||
|
|
||||||
#undef __static
|
#undef __static
|
||||||
|
|
||||||
|
@ -204,10 +204,7 @@ void check_intof() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
unsigned long long a;
|
unsigned long long a;
|
||||||
/* caveat emptor: */
|
a=0; assert(add_of(a,0xfffffff0ul,0x10)==0 && a==0x100000000);
|
||||||
a=0; assert(add_of(a,0xfffffff0,0x10)==1);
|
|
||||||
/* this does NOT work and set a to 0x100000000, just like
|
|
||||||
* a=0xfffffff0+0x10 sets a to 0 in C! */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user