[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] some trivial patches



On Mon, May 30, 2011 at 11:02 AM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
> 0001 and 0002 look like non-starters. ÂThey change a published
> interface. ÂCode that followed the documented interface of
> evhttp_*_set_max_*_size that Âwould have worked before will no longer
> work with these changes applied. ÂWe seriously try not to break
> correct programs.

Good point, scratch those.

> 0004 and the formatting part of 0005 look fine, but there's no actual
> guarantee that a size_t can fit inside an unsigned long. ÂIf we're
> trying to fix that part of the code, we should fix it for real, and
> format it properly. Â(Do all the targets we care about support the %z
> format, or do we need to get fancy?)

%z would be supported anywhere C99 is. I think that might already be a
requirement. Otherwise, using macros could work, something like so:

  #if defined(__STDC__) && (__STDC_VERSION__ >= 199901L)
  #define SIZE_FMT "%zu"
  #define SIZE_FMT_CAST
  #else
  #define SIZE_FMT "%lu"
  #define SIZE_FMT_CAST (unsigned long)
  #endif

  printf(SIZE_FMT"\n", SIZE_FMT_CAST foo);

> with respect to the rest of 0005, I don't see what's so bad about
> doing an (x > 0) check on an unsigned x. ÂAny well-behaved compiler
> should generate good code here, right?

Right, those changes were overly pedantic.

>> PS: Is it best to post to the list or the tracker?
>
> People send some patches to the list, some to the tracker, and some to
> github. ÂI used to say "Send everything to the tracker!" but right now
> I'm trying to be more flexible and work with everything at once to see
> how it goes, and whether a mixed methodology serves us better.
>
> That said, my inbox is not a persistent medium: anything that
> shouldn't get lost really ought to be on the tracker.

Got it, I'll post any future stuff to the tracker.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.