httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Prindeville <philipp_s...@redfish-solutions.com>
Subject Re: logging patch bug
Date Wed, 13 Oct 2010 21:46:06 GMT
  On 10/12/10 12:57 PM, Stefan Fritsch wrote:
> On Monday 11 October 2010, William A. Rowe Jr. wrote:
>> Why were ap_errorlog_format_item->min_loglevel and
>> ap_errorlog_info->level declared with two different types?
> ap_errorlog_info->level is -1 if no log level is available, i.e. when
> logging per-request/per-conn info. However, ap_errorlog_format_item-
>> min_loglevel always contains a genuine loglevel (which is>=0).
> Therefore I have declared the former as signed int and the latter as
> unsigned int.
>
> But the comparison (item->min_loglevel>  info->level) in log.c does
> cause a warning with -Wextra, even if it is correct. What do you
> suggest? Adding a cast or changing the declaration of min_loglevel to
> signed int?

If they are only compared in one place, I'd use a cast.  Least churn, and it means that static
analysis could still be used elsewhere to easily detect when out-of-range assignments are
made to the latter.


Mime
View raw message