}
if (o != NULL) {
AZ(pthread_mutex_unlock(&oh->mtx));
- hash->deref(oh);
+ (void)hash->deref(oh);
return (o);
}
#include <errno.h>
static void
-http_read_f(int fd, short event __unused, void *arg)
+http_read_f(int fd, short event, void *arg)
{
struct http *hp = arg;
unsigned l;
int i, ret = 0;
+ (void)event;
+
l = hp->e - hp->v;
if (l <= 1) {
VSL(SLT_HttpError, fd, "Received too much");
assert(hp->v <= hp->e);
assert(hp->t <= hp->v);
if (0)
- VSL(SLT_Debug, fd, "Recv t %u v %u", hp->t - hp->s, hp->v - hp->s);
+ VSL(SLT_Debug, fd, "Recv t %u v %u",
+ hp->t - hp->s, hp->v - hp->s);
if (hp->t > hp->s && hp->t < hp->v) {
l = hp->v - hp->t;
memmove(hp->s, hp->t, l);
hp->callback = func;
hp->arg = arg;
event_set(&hp->ev, fd, EV_READ | EV_PERSIST, http_read_f, hp);
- event_base_set(eb, &hp->ev);
- event_add(&hp->ev, NULL); /* XXX: timeout */
+ AZ(event_base_set(eb, &hp->ev));
+ AZ(event_add(&hp->ev, NULL)); /* XXX: timeout */
}
/*--------------------------------------------------------------------*/
struct stevedore *stevedore;
-struct varnish_stats *VSL_stats;
-
/*--------------------------------------------------------------------*/
static void
timer_keepalive(int a, short b, void *c)
{
- printf("%s(%d, %d, %p)\n", __func__, a, (int)b, c);
+ printf("%s(%d, %d, %p)\n", (const char *)__func__, a, (int)b, c);
printf("Heeellloooo ? Ohh bother...\n");
exit (1);
}
tv.tv_sec = 30;
tv.tv_usec = 0;
- evtimer_del(&ev_keepalive);
- evtimer_add(&ev_keepalive, &tv);
+ AZ(evtimer_del(&ev_keepalive));
+ AZ(evtimer_add(&ev_keepalive, &tv));
}
/*--------------------------------------------------------------------*/
if (av[2] != NULL) {
/* XXX: check clock skew is pointless here */
}
- time(&t);
+ t = time(NULL);
cli_out(cli, "PONG %ld\n", t);
}
cli = cli_setup(eb, heritage.fds[2], heritage.fds[1], 0, cli_proto);
evtimer_set(&ev_keepalive, timer_keepalive, NULL);
- event_base_set(eb, &ev_keepalive);
+ AZ(event_base_set(eb, &ev_keepalive));
arm_keepalive();
printf("Ready\n");
#include <sys/socket.h>
#include <netdb.h>
-#include "libvarnish.h"
#include "shmlog.h"
#include "cache.h"
*/
hp = vc->http;
http_RecvHead(hp, vc->fd, w->eb, NULL, NULL);
- event_base_loop(w->eb, 0);
+ (void)event_base_loop(w->eb, 0);
http_DissectResponse(hp, vc->fd);
sp->bkd_http = hp;
};
static void
-rdf(int fd, short event __unused, void *arg)
+rdf(int fd, short event, void *arg)
{
int i, j;
struct edir *ep;
char buf[BUFSIZ];
+ (void)event;
+
ep = arg;
i = read(fd, buf, sizeof buf);
if (i <= 0) {
shutdown(fd, SHUT_RD);
shutdown(ep->fd, SHUT_WR);
- event_del(&ep->ev);
+ AZ(event_del(&ep->ev));
} else {
j = write(ep->fd, buf, i);
if (i != j) {
shutdown(fd, SHUT_WR);
shutdown(ep->fd, SHUT_RD);
- event_del(&ep->ev);
+ AZ(event_del(&ep->ev));
}
}
}
e1.fd = vc->fd;
e2.fd = sp->fd;
event_set(&e1.ev, sp->fd, EV_READ | EV_PERSIST, rdf, &e1);
- event_base_set(w->eb, &e1.ev);
+ AZ(event_base_set(w->eb, &e1.ev));
event_set(&e2.ev, vc->fd, EV_READ | EV_PERSIST, rdf, &e2);
- event_base_set(w->eb, &e2.ev);
- event_add(&e1.ev, NULL);
- event_add(&e2.ev, NULL);
- event_base_loop(w->eb, 0);
+ AZ(event_base_set(w->eb, &e2.ev));
+ AZ(event_add(&e1.ev, NULL));
+ AZ(event_add(&e2.ev, NULL));
+ (void)event_base_loop(w->eb, 0);
vca_close_session(sp, "pipe");
VBE_ClosedFd(vc);
}
}
/* If we are a dynamic thread, time out and die */
- clock_gettime(CLOCK_REALTIME, &ts);
+ AZ(clock_gettime(CLOCK_REALTIME, &ts));
ts.tv_sec += heritage.wthread_timeout;
if (pthread_cond_timedwait(&w->cv, &wrk_mtx, &ts)) {
VSL_stats->n_wrk--;
struct worker *w;
pthread_t tp;
- time(&sp->t_req);
+ sp->t_req = time(NULL);
/*
* No locking necessary, we're serialized in the acceptor thread
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <dlfcn.h>
-#include "cli.h"
-#include "cli_priv.h"
#include "shmlog.h"
#include "vrt.h"
#include "vcl.h"
-#include "libvarnish.h"
#include "cache.h"
/*--------------------------------------------------------------------*/
VRT_error(struct sess *sp, unsigned err, const char *str)
{
+ (void)sp;
VSL(SLT_Debug, 0, "VCL_error(%u, %s)", err, str);
}
sbuf_finish(cli->sb);
/* XXX: syslog results ? */
encode_output(cli);
- bufferevent_enable(cli->bev1, EV_WRITE);
+ AZ(bufferevent_enable(cli->bev1, EV_WRITE));
}
}
static void
-wrcb(struct bufferevent *bev __unused, void *arg)
+wrcb(struct bufferevent *bev, void *arg)
{
struct cli *cli = arg;
- bufferevent_disable(cli->bev1, EV_WRITE);
+ (void)bev;
+ AZ(bufferevent_disable(cli->bev1, EV_WRITE));
}
static void
cli->bev0 = bufferevent_new(fdr, rdcb, wrcb, excb, cli);
assert(cli->bev0 != NULL);
- bufferevent_base_set(eb, cli->bev0);
+ AZ(bufferevent_base_set(eb, cli->bev0));
if (fdr == fdw)
cli->bev1 = cli->bev0;
else
cli->bev1 = bufferevent_new(fdw, rdcb, wrcb, excb, cli);
assert(cli->bev1 != NULL);
- bufferevent_base_set(eb, cli->bev1);
+ AZ(bufferevent_base_set(eb, cli->bev1));
cli->sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND);
assert(cli->sb != NULL);
cli->verbose = ver;
cli->cli_proto = cli_proto;
- bufferevent_enable(cli->bev0, EV_READ);
+ AZ(bufferevent_enable(cli->bev0, EV_READ));
return (cli);
}
{
cli->suspend = 1;
- bufferevent_disable(cli->bev0, EV_READ);
+ AZ(bufferevent_disable(cli->bev0, EV_READ));
}
void
sbuf_finish(cli->sb);
/* XXX: syslog results ? */
encode_output(cli);
- bufferevent_enable(cli->bev1, EV_WRITE);
+ AZ(bufferevent_enable(cli->bev1, EV_WRITE));
cli->suspend = 0;
- bufferevent_enable(cli->bev0, EV_READ);
+ AZ(bufferevent_enable(cli->bev0, EV_READ));
}
-e728 // Symbol ... not explicitly initialized
-e716 // while(1) ...
-e785 // Too few initializers for aggregate
+-e786 // String concatenation within initializer
-emacro(740, TAILQ_PREV) // Unusual pointer cast (incompatible indirect types)
-emacro((826), TAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small)
-esym(534, fprintf) // Ignoring return value of function
-esym(534, memset) // Ignoring return value of function
-esym(534, memcpy) // Ignoring return value of function
+-esym(534, memmove) // Ignoring return value of function
+-esym(534, strcpy) // Ignoring return value of function
-esym(534, sbuf_printf) // Ignoring return value of function
-esym(534, sbuf_cat) // Ignoring return value of function
-esym(528, vcl_handlingname) // Not referenced
-e641 // Converting enum 'cli_status_e' to int
-// storage_file.c
-
-// Review all below this line
-
-// -printf_code( H, void *, unsigned)
-// -printf_code( ju, long long unsigned)
-// -printf_code( jx, long long unsigned)
-//
+// Review all below this line ///////////////////////////////////////////////
-e767 // Macro redef (system queue.h vs ours )
-e712 // Loss of precision (assignment) (long long to
-e747 // Significant prototype coercion (arg. no. 2) long
-e713 // Loss of precision (assignment) (unsigned long long to long long)
+-e506 // Constant value boolean
+-e818 // Pointer parameter '...' could be declared as pointing to const
+-e774 // Boolean within 'if' always evaluates to False
+-e534 // Ignoring return value of function
+-e557 // unrecog format
+-e732 // Loss of sign (arg. no. 2) (int to unsigned
+-e737 // [45] Loss of sign in promotion from int to unsigned
-//
-//
--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
-//
-// -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)
-//
-//
-//
-// -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
-//
-//
-// -e786 // String concatenation within initializer
#!/bin/sh
+T=/tmp/_$$
flexelint \
-I/usr/include \
-I. \
-I../../include \
-I../../contrib/libevent \
flint.lnt \
- *.c
+ *.c > $T 2>&1
+
+for t in Error Warning Info
+do
+ sed -n "/$t [0-9][0-9][0-9]:/s/.*\($t [0-9][0-9][0-9]\).*/\1/p" $T
+done | awk '
+$2 == 830 { next }
+$2 == 831 { next }
+ {
+ i=$2"_"$1
+ h[i]++
+ n++
+ }
+END {
+ printf "%5d %s\n", n, "Total"
+ for (i in h)
+ printf "%5d %s\n", h[i], i
+ }
+' | sort -rn
+
+cat $T
time_t h_date, h_expires, ttd;
char *p;
+ (void)t_resp; /* XXX */
+
retirement_age = INT_MAX;
u1 = u2 = 0;
if (loghead->ptr + 4 + l + 1 > loghead->size)
vsl_wrap();
p = logstart + loghead->ptr;
- p[1] = l;
- p[2] = id >> 8;
+ p[1] = l & 0xff;
+ p[2] = (id >> 8) & 0xff;
p[3] = id & 0xff;
memcpy(p + 4, b, l);
p[4 + l] = SLT_ENDMARKER;
}
static void
-m_cli_func_passthrough(struct cli *cli, char **av, void *priv __unused)
+m_cli_func_passthrough(struct cli *cli, char **av, void *priv)
{
(void)av;
+ (void)priv;
cli_suspend(cli);
mgt_child_request(cli_passthrough_cb, cli, &av[2], av[1]);
if (av[2] != NULL) {
cli_out(cli, "Got your %s\n", av[2]);
}
- time(&t);
+ t = time(NULL);
cli_out(cli, "PONG %ld\n", t);
}
cli = cli_setup(mgt_eb, 0, 1, 1, cli_proto);
signal_set(&e_sigchld, SIGCHLD, mgt_sigchld, NULL);
- event_base_set(mgt_eb, &e_sigchld);
- signal_add(&e_sigchld, NULL);
+ AZ(event_base_set(mgt_eb, &e_sigchld));
+ AZ(signal_add(&e_sigchld, NULL));
mgt_child_start();
const char *sflag = "file";
const char *hflag = "classic";
- register_printf_render_std((const unsigned char *)"HVQ");
+ (void)register_printf_render_std((const unsigned char *)"HVQ");
setbuf(stdout, NULL);
setbuf(stderr, NULL);