Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] print format for nevents

Maxim Dounin
August 06, 2014 01:22PM
Hello!

On Wed, Aug 06, 2014 at 12:28:00PM -0400, crespin wrote:

> Maxim Dounin Wrote:
> -------------------------------------------------------
> > Hello!
> >
> > On Wed, Aug 06, 2014 at 10:22:10AM -0400, crespin wrote:
> >
> > > Hello,
> > >
> > > nevents is an ngx_int_t, so the print format must be "%i".
> >
> > Both signed and unsigned ngx_[u]int_t has the same size, so that's
> > more about preferable representation of numbers, not about
> > correctness of the code.
>
> Thanks for the link.
>
> The format %d is used in another call to nevents.
> To be consistent, should not use %ui ?
>
> Regards,
>
> yves
>
> static ngx_int_t
> ngx_poll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t
> flags)
> ...
> ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
> "poll ready %d of %d", ready, nevents);

Yes, %d here is certainly incorrect, as int and ngx_int_t sizes
may differ. I don't think there are any platforms with poll()
where this may cause problems, but nevertheless it's worth fixing.
Changing this to %ui should be ok.

Care to provide a patch?

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

[PATCH] print format for nevents

crespin August 06, 2014 10:22AM

Re: [PATCH] print format for nevents

Maxim Dounin August 06, 2014 12:06PM

Re: [PATCH] print format for nevents

crespin August 06, 2014 12:28PM

Re: [PATCH] print format for nevents

Maxim Dounin August 06, 2014 01:22PM

Re: [PATCH] print format for nevents

crespin August 07, 2014 09:08AM

Re: [PATCH] print format for nevents

Maxim Dounin August 10, 2014 09:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 285
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready