Changeset dfec9683c6674557f3639bb6485d369ebd6a347b

Show
Ignore:
Timestamp:
11/30/11 17:10:51 (2 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1322673051 -0500
git-parent:

[67a6f35109ef607de8abcc340885cfcd7a6b9966]

git-author:
Igor Galić <i.galic@brainsware.org> 1322651102 +0100
Message:

Make sure we compile with clang (trunk) on Ubuntu 11.10

This is a good milestone, so let's do an intermediate commit:
At this point we are able to compile with Clang (trunk, no less;)
on Ubuntu 11.10. I was careful with the introduced changes not to
introduce any regressions:

* bsd/libutil.h is prefered, otherwise we fallback to libutil.h
* replaced isinteger()'s guts with a call to strtod()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • configure.in

    rd9e10d1 rdfec968  
    387387                 termio.h termios.h curses.h sys/cdefs.h grp.h netinet/in_systm.h \ 
    388388                 sys/ioctl_compat.h sys/filio.h util.h sys/time.h sys/mman.h \ 
    389                  sys/ioctl.h stropts.h sys/stream.h alloca.h sys/wait.h libutil.h) 
     389                 sys/ioctl.h stropts.h sys/stream.h alloca.h sys/wait.h bsd/libutil.h libutil.h) 
    390390AC_CHECK_HEADERS([term.h], [], [], 
    391391     [[#ifdef HAVE_CURSES_H 
     
    404404                 # include <termios.h> 
    405405                 #endif 
    406                  #if defined(HAVE_LIBUTIL_H) 
     406                 #if defined(HAVE_BSD_LIBUTIL_H) 
     407                 # include <bsd/libutil.h> 
     408                 #elif defined(HAVE_LIBUTIL_H) 
    407409                 # include <libutil.h> 
    408410                 #endif 
  • src/modules/collectd.c

    rf91ddca rdfec968  
    479479  exp_size = 3 * sizeof (uint16_t) 
    480480    + pkg_numval * (sizeof (uint8_t) + sizeof (value_t)); 
    481   if ((buffer_len < 0) || (buffer_len < exp_size)
     481  if (buffer_len < exp_size
    482482  { 
    483483    noitL(noit_error, "collectd: parse_part_values: " 
     
    564564  uint16_t pkg_length; 
    565565 
    566   if ((buffer_len < 0) || ((size_t) buffer_len < exp_size)
     566  if ((size_t) buffer_len < exp_size
    567567  { 
    568568    noitL(noit_error, "collectd: parse_part_number: " 
     
    602602  uint16_t pkg_length; 
    603603 
    604   if ((buffer_len < 0) || (buffer_len < header_size)
     604  if (buffer_len < header_size
    605605  { 
    606606    noitL(noit_error, "collectd: parse_part_string: " 
  • src/modules/libstomp.c

    r6b98359 rdfec968  
    313313      } 
    314314 
    315           if(frame->body_length >= 0) { 
     315          if(frame->body_length > 0) { 
    316316                  apr_pool_t *length_pool; 
    317317                  char *length_string; 
  • src/modules/libstomp.h

    r7afb4e3 rdfec968  
    3838   apr_hash_t *headers; 
    3939   char *body; 
    40    int body_length; 
     40   apr_size_t body_length; 
    4141} stomp_frame; 
    4242 
  • src/modules/snmp.c

    r21ecdb1 rdfec968  
    525525      i++) { 
    526526    oid v = o[i + reconnoiter_check_prefix_oid_len]; 
    527     if(v < 0 || v > 0xffff) { 
     527    if(v > 0xffff) { 
    528528      noitL(nlerr, "trap target oid [%ld] out of range\n", (long int)v); 
    529529      return -1; 
  • src/noit_config.h.in

    r7ab9795 rdfec968  
    6060#undef HAVE_SYS_STREAM_H 
    6161#undef HAVE_UTIL_H 
     62#undef HAVE_BSD_LIBUTIL_H 
    6263#undef HAVE_LIBUTIL_H 
    6364#undef HAVE_CURSES_H 
  • src/noit_console.c

    r51743db rdfec968  
    6161#include <util.h> 
    6262#endif 
    63 #ifdef HAVE_LIBUTIL_H 
     63#ifdef HAVE_BSD_LIBUTIL_H 
     64#include <bsd/libutil.h> 
     65#elif HAVE_LIBUTIL_H 
    6466#include <libutil.h> 
    6567#endif 
  • src/noit_console_complete.c

    rc6a5f68 rdfec968  
    266266       */ 
    267267      size_t alen = strlen(matches[0]); 
    268       if ((alen > 0 && (matches[0])[alen - 1] != '/') 
    269           && rl_completion_append_character) { 
     268      if ((alen > 0 && (matches[0])[alen - 1] != '/')) { 
    270269        char buf[2]; 
    271270        buf[0] = rl_completion_append_character; 
  • src/udns/udns_resolver.c

    rc38b364 rdfec968  
    12181218  d->dnsrd_result = result; 
    12191219  d->dnsrd_done = 1; 
    1220   ctx = ctx; 
     1220  (void)ctx; 
    12211221} 
    12221222 
  • src/utils/noit_security.c

    r670f01e rdfec968  
    3535#include <stdio.h> 
    3636#include <unistd.h> 
     37#include <ctype.h> 
    3738#include <sys/time.h> 
    3839#include <pwd.h> 
     
    5455 
    5556static inline int isinteger(const char *user) { 
    56   const char *cp = user; 
    57   while(*cp) { 
    58     switch(cp == user) { 
    59       case 0: 
    60         if(*cp < '0' || *cp > '9') return 0; 
    61         break; 
    62       default: 
    63         if(*cp != '-' && (*cp < '0' || *cp > '9')) return 0; 
    64     } 
    65     cp++; 
    66   } 
    67   return (cp != user); 
     57  char *cp; 
     58  if (user == NULL || *user == '\0' || isblank(*user)) return 0; 
     59  strtod (user, &cp); 
     60  return (cp == '\0'); 
    6861} 
    6962static struct passwd *