#include <sbuf.h>
#include "config.h"
-#include "compat.h"
#include "libvarnish.h"
#include "heritage.h"
#include "shmlog.h"
}
static void
-vca_delete_sess(struct sess *sp)
+vca_delete_sess(const struct sess *sp)
{
VSL_stats->n_sess--;
/*--------------------------------------------------------------------*/
static void
-vca_tick(int a __unused, short b __unused, void *c __unused)
+vca_tick(int a, short b, void *c)
{
struct sess *sp, *sp2;
time_t t;
- evtimer_add(&tick_e, &tick_rate);
- time(&t);
+ (void)a;
+ (void)b;
+ (void)c;
+ AZ(evtimer_add(&tick_e, &tick_rate));
+ (void)time(&t);
TAILQ_FOREACH_SAFE(sp, &sesshead, list, sp2) {
if (sp->t_resp + 30 < t) {
TAILQ_REMOVE(&sesshead, sp, list);
}
static void
-pipe_f(int fd, short event __unused, void *arg __unused)
+pipe_f(int fd, short event, void *arg)
{
struct sess *sp;
int i;
+ (void)event;
+ (void)arg;
i = read(fd, &sp, sizeof sp);
assert(i == sizeof sp);
- time(&sp->t_resp);
+ sp->t_resp = time(NULL);
TAILQ_INSERT_TAIL(&sesshead, sp, list);
http_RecvHead(sp->http, sp->fd, evb, vca_callback, sp);
}
static void
-accept_f(int fd, short event __unused, void *arg __unused)
+accept_f(int fd, short event, void *arg)
{
socklen_t l;
struct sockaddr addr[2]; /* XXX: IPv6 hack */
int i;
struct linger linger;
+ (void)event;
+ (void)arg;
VSL_stats->client_conn++;
sp = vca_new_sess();
TCP_name(addr, l, sp->addr);
VSL(SLT_SessionOpen, sp->fd, "%s", sp->addr);
- time(&sp->t_resp);
+ (void)time(&sp->t_resp);
TAILQ_INSERT_TAIL(&sesshead, sp, list);
http_RecvHead(sp->http, sp->fd, evb, vca_callback, sp);
}
static void *
-vca_main(void *arg __unused)
+vca_main(void *arg)
{
unsigned u;
struct event *ep;
+ (void)arg;
+
AZ(pipe(pipes));
evb = event_init();
+ assert(evb != NULL);
event_set(&pipe_e, pipes[0], EV_READ | EV_PERSIST, pipe_f, NULL);
- event_base_set(evb, &pipe_e);
- event_add(&pipe_e, NULL);
+ AZ(event_base_set(evb, &pipe_e));
+ AZ(event_add(&pipe_e, NULL));
evtimer_set(&tick_e, vca_tick, NULL);
- event_base_set(evb, &tick_e);
+ AZ(event_base_set(evb, &tick_e));
- evtimer_add(&tick_e, &tick_rate);
+ AZ(evtimer_add(&tick_e, &tick_rate));
ep = accept_e;
for (u = 0; u < HERITAGE_NSOCKS; u++) {
event_set(ep, heritage.sock_local[u],
EV_READ | EV_PERSIST,
accept_f, NULL);
- event_base_set(evb, ep);
- event_add(ep, NULL);
+ AZ(event_base_set(evb, ep));
+ AZ(event_add(ep, NULL));
ep++;
}
if (heritage.sock_remote[u] >= 0) {
event_set(ep, heritage.sock_remote[u],
EV_READ | EV_PERSIST,
accept_f, NULL);
- event_base_set(evb, ep);
- event_add(ep, NULL);
+ AZ(event_base_set(evb, ep));
+ AZ(event_add(ep, NULL));
ep++;
}
}
- event_base_loop(evb, 0);
- assert(0 == 1);
- return (NULL);
+ AZ(event_base_loop(evb, 0));
+ INCOMPL();
}
/*--------------------------------------------------------------------*/
{
VSL(SLT_SessionClose, sp->fd, why);
- close(sp->fd);
+ if (sp->fd >= 0)
+ AZ(close(sp->fd));
sp->fd = -1;
}
if (sp->fd >= 0) {
VSL(SLT_SessionReuse, sp->fd, "%s", sp->addr);
- write(pipes[1], &sp, sizeof sp);
+ assert(sizeof sp == write(pipes[1], &sp, sizeof sp));
} else {
vca_delete_sess(sp);
}
-passes=3
-// Review all below this line
-
--printf_code( H, void *, unsigned)
--printf_code( ju, long long unsigned)
--printf_code( jx, long long unsigned)
+// Fix strchr() semtics, it can only return NULL if arg2 != 0
+-sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
-e763 // Redundant declaration for symbol '...' previously declared
+-e726 // Extraneous comma ignored
+-e728 // Symbol ... not explicitly initialized
+-esym(534, fprintf) // Ignoring return value of function
+-esym(534, memset) // Ignoring return value of function
+-esym(534, sbuf_printf) // Ignoring return value of function
--e737 // Loss of sign in promotion from int to unsigned int
--e715 // Symbol 'arg' (line 43) not referenced
--e818 // Pointer parameter '...' could be declared as pointing to const
-
--e534 // Ignoring return value of function
--e767 // macro 'LIST_INIT' was defined differently
-
--e506 // Constant value boolean
--e527 // Unreachable code at token 'return'
--e732 // Loss of sign (arg. no. 2) (int to unsigned int)
--e774 // Boolean within 'if' always evaluates to False
--e713 // Loss of precision (assignment) (unsigned long long to long long)
--e574 // Signed-unsigned mix with relational
-
--e525 // Negative indentation from line 90
--e539 // Did not expect positive indentation
--e725 // Expected positive indentation from line 136
--e734 // Loss of precision (assignment) (31 bits to 8 bits)
--e747 // Significant prototype coercion (arg. no. 2) long
--e712 // Loss of precision (assignment) (long long to
-
+// cache.h
+-emacro(506, INCOMPL) // Constant value Boolean
--e785 // Too few initializers for aggregate
-
--e766 // Header file '../../include/libvarnish.h' not used in module
+// cache_vcl.c
+-efunc(525, vcl_handlingname) // Negative indentation from line
+-esym(528, vcl_handlingname) // Not referenced
+-e641 // Converting enum 'cli_status_e' to int
--e773 // Expression-like macro 'VCL_FARGS' not parenthesized
+// Review all below this line
--e788 // enum constant 'HND_Unclass' not used within defaulted switch
+// -printf_code( H, void *, unsigned)
+// -printf_code( ju, long long unsigned)
+// -printf_code( jx, long long unsigned)
+//
--e716 // while(1) ...
--e641 // Converting enum 'cli_status_e' to int
--e786 // String concatenation within initializer
-
--emacro(19, MAC_STAT) // Useless Declaration
+//
+//
+-e737 // Loss of sign in promotion from int to unsigned int
+-e732 // Loss of sign (arg. no. 2) (int to unsigned int)
+// -e715 // Symbol 'arg' (line 43) not referenced
+// -e818 // Pointer parameter '...' could be declared as pointing to const
+//
+// -e534 // Ignoring return value of function
+// -e767 // macro 'LIST_INIT' was defined differently
+//
+// -e506 // Constant value boolean
+// -e527 // Unreachable code at token 'return'
+// -e774 // Boolean within 'if' always evaluates to False
+// -e713 // Loss of precision (assignment) (unsigned long long to long long)
+// -e574 // Signed-unsigned mix with relational
+//
+// -e525 // Negative indentation from line 90
+// -e539 // Did not expect positive indentation
+// -e725 // Expected positive indentation from line 136
+// -e734 // Loss of precision (assignment) (31 bits to 8 bits)
+// -e747 // Significant prototype coercion (arg. no. 2) long
+// -e712 // Loss of precision (assignment) (long long to
+//
+//
+// -e785 // Too few initializers for aggregate
+//
+// -e766 // Header file '../../include/libvarnish.h' not used in module
+//
+// -e773 // Expression-like macro 'VCL_FARGS' not parenthesized
+//
+// -e788 // enum constant 'HND_Unclass' not used within defaulted switch
+//
+// -e716 // while(1) ...
+//
+// -e786 // String concatenation within initializer