Browse Source

some valgrind de-noising

fix subtle typo in sub_of (David Sirovsky)
master
Felix von Leitner 12 years ago
parent
commit
6d98b442ab
7 changed files with 7 additions and 5 deletions
  1. +1
    -0
      CHANGES
  2. +1
    -0
      io/io_dontwantread.c
  3. +1
    -0
      io/io_dontwantwrite.c
  4. +1
    -0
      io/io_wantread.c
  5. +1
    -0
      io/io_wantwrite.c
  6. +1
    -1
      rangecheck.h
  7. +1
    -4
      test/range.c

+ 1
- 0
CHANGES View File

@@ -1,5 +1,6 @@
0.28:
add uint64 pack and unpack routines
fix subtle typo in sub_of (David Sirovsky)

0.27:
add fmt_strm


+ 1
- 0
io/io_dontwantread.c View File

@@ -26,6 +26,7 @@ void io_dontwantread(int64 d) {
#ifdef HAVE_EPOLL
if (io_waitmode==EPOLL) {
struct epoll_event x;
byte_zero(&x,sizeof(x)); // to shut up valgrind
x.events=0;
if (e->wantwrite) x.events|=EPOLLOUT;
x.data.fd=d;


+ 1
- 0
io/io_dontwantwrite.c View File

@@ -26,6 +26,7 @@ void io_dontwantwrite(int64 d) {
#ifdef HAVE_EPOLL
if (io_waitmode==EPOLL) {
struct epoll_event x;
byte_zero(&x,sizeof(x)); // to shut up valgrind
x.events=0;
if (e->wantread) x.events|=EPOLLIN;
x.data.fd=d;


+ 1
- 0
io/io_wantread.c View File

@@ -32,6 +32,7 @@ void io_wantread(int64 d) {
#ifdef HAVE_EPOLL
if (io_waitmode==EPOLL) {
struct epoll_event x;
byte_zero(&x,sizeof(x)); // to shut up valgrind
x.events=EPOLLIN;
if (e->wantwrite) x.events|=EPOLLOUT;
x.data.fd=d;


+ 1
- 0
io/io_wantwrite.c View File

@@ -29,6 +29,7 @@ void io_wantwrite(int64 d) {
#ifdef HAVE_EPOLL
if (io_waitmode==EPOLL) {
struct epoll_event x;
byte_zero(&x,sizeof(x)); // to shut up valgrind
x.events=EPOLLOUT;
if (e->wantread) x.events|=EPOLLIN;
x.data.fd=d;


+ 1
- 1
rangecheck.h View File

@@ -106,7 +106,7 @@ int range_str4inbuf(const void* buf,size_t len,const void* stringstart);
* 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 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



+ 1
- 4
test/range.c View File

@@ -204,10 +204,7 @@ void check_intof() {

{
unsigned long long a;
/* caveat emptor: */
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! */
a=0; assert(add_of(a,0xfffffff0ul,0x10)==0 && a==0x100000000);
}

}


Loading…
Cancel
Save