On Mon, Dec 08, 2014 at 17:18, David Carlier wrote:
> Following small discussion I had with tedu@ this is just small diff, just
> for the sake of C standard "correctness" ... dropping some arithmetic
> pointer with void pointers ...
> 
> Hopes it might find some interest/usefullness ...

Thanks.

> Index: gnu/gcc/gcc/unwind-dw2.c

I don't think we want to mess with gcc.

> Index: lib/librthread/rthread_np.c

Fixed.

> Index: libexec/ld.so/util.c

I'll let somebody else take this one, but I think it's right.

> Index: usr.sbin/nsd/difffile.c
> Index: usr.sbin/nsd/udb.h

All the nsd diffs should be sent to them.

> Index: usr.sbin/nsd/xfrd-tcp.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/nsd/xfrd-tcp.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 xfrd-tcp.c
> --- usr.sbin/nsd/xfrd-tcp.c    16 Sep 2014 17:01:38 -0000    1.9
> +++ usr.sbin/nsd/xfrd-tcp.c    8 Dec 2014 17:04:01 -0000
> @@ -40,7 +40,7 @@ xfrd_pipe_cmp(const void* a, const void*
> if(x->num_unused != y->num_unused)
> return x->num_unused - y->num_unused;
> /* different pipelines are different still, even with same numunused*/
> -    return (int)(a - b);
> +    return (int)((char *)a - (char *)b);
> }
> 
> xfrd_tcp_set_t* xfrd_tcp_set_create(struct region* region)

This by the way looks wrong. 64 bit pointers can be too far away for
this to work. It needs to be expanded to if (a > b) return 1 ...

Actually, it doesn't always even work for 32 bits. If a is more than
2B greater than b, it will return less than, not greater. The same is
true for integers and pointers. (a - b) is a dangerous sort idiom.

Reply via email to