#include <assert.h>
#include <pthread.h>
#include <sys/time.h>
-#include <queue.h>
-#include <event.h>
+
+#include "queue.h"
+#include "event.h"
+#include "sbuf.h"
#include "vcl_returns.h"
#include "common.h"
#include <netdb.h>
-#include <sbuf.h>
-
#include "config.h"
#include "libvarnish.h"
#include "heritage.h"
#include <sys/socket.h>
#include <netdb.h>
-#include <sbuf.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
if (i) {
char buf[512];
- regerror(i, &b->regexp, buf, sizeof buf);
+ (void)regerror(i, &b->regexp, buf, sizeof buf);
VSL(SLT_Debug, 0, "REGEX: <%s>", buf);
}
b->gen = ++ban_next;
}
void
-cli_func_url_purge(struct cli *cli, char **av, void *priv __unused)
+cli_func_url_purge(struct cli *cli, char **av, void *priv)
{
+ (void)priv;
AddBan(av[2]);
cli_out(cli, "PURGE %s\n", av[2]);
}
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sbuf.h>
-#include "libvarnish.h"
-#include "heritage.h"
#include "shmlog.h"
#include "vcl.h"
#include "cache.h"
CNT_Session(struct worker *w, struct sess *sp)
{
- time(&sp->t0);
+ sp->t0 = time(NULL);
sp->vcl = VCL_Get();
for (sp->step = STP_RECV; sp->step != STP_DONE; ) {
*/
static void *
-exp_hangman(void *arg __unused)
+exp_hangman(void *arg)
{
struct object *o;
time_t t;
+ (void)arg;
+
while (1) {
- time (&t);
+ t = time(NULL);
AZ(pthread_mutex_lock(&exp_mtx));
TAILQ_FOREACH(o, &exp_deathrow, deathrow) {
if (o->ttl >= t)
}
if (o == NULL || o->ttl >= t || o->refcnt > 0) {
AZ(pthread_mutex_unlock(&exp_mtx));
- sleep(1);
+ AZ(sleep(1));
continue;
}
TAILQ_REMOVE(&exp_deathrow, o, deathrow);
*/
static void *
-exp_prefetch(void *arg __unused)
+exp_prefetch(void *arg)
{
struct object *o;
time_t t;
struct sess sp;
+ (void)arg;
+
while (1) {
- time(&t);
+ t = time(NULL);
AZ(pthread_mutex_lock(&exp_mtx));
o = binheap_root(exp_heap);
if (o == NULL || o->ttl > t + expearly) {
AZ(pthread_mutex_unlock(&exp_mtx));
- sleep(1);
+ AZ(sleep(1));
continue;
}
binheap_delete(exp_heap, 0);
/*--------------------------------------------------------------------*/
static int
-object_cmp(void *priv __unused, void *a, void *b)
+object_cmp(void *priv, void *a, void *b)
{
struct object *aa, *bb;
+ (void)priv;
+
aa = a;
bb = b;
return (aa->ttl < bb->ttl);
}
static void
-object_update(void *priv __unused, void *p, unsigned u)
+object_update(void *priv, void *p, unsigned u)
{
struct object *o = p;
+ (void)priv;
o->heap_idx = u;
}
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
-#include <sbuf.h>
#include "libvarnish.h"
#include "shmlog.h"
#define CHUNK_PREALLOC (128 * 1024)
/*--------------------------------------------------------------------*/
+
static int
-fetch_straight(struct sess *sp, int fd, struct http *hp, char *b)
+fetch_straight(const struct sess *sp, int fd, struct http *hp, char *b)
{
int i;
char *e;
/* XXX: Cleanup. It must be possible somehow :-( */
static int
-fetch_chunked(struct sess *sp, int fd, struct http *hp)
+fetch_chunked(const struct sess *sp, int fd, struct http *hp)
{
int i;
char *b, *q, *e;
#include <errno.h>
static int
-fetch_eof(struct sess *sp, int fd, struct http *hp)
+fetch_eof(const struct sess *sp, int fd, struct http *hp)
{
int i;
char *b, *e;
sp->obj->len += i;
}
- if (st != NULL && stevedore->trim != NULL)
+ if (stevedore->trim != NULL)
stevedore->trim(st, st->len);
return (1);
http_BuildSbuf(vc->fd, Build_Fetch, w->sb, sp->http);
i = write(vc->fd, sbuf_data(w->sb), sbuf_len(w->sb));
assert(i == sbuf_len(w->sb));
- time(&sp->t_req);
+ sp->t_req = time(NULL);
/* XXX: copy any body ?? */
* XXX: read(2) the header
*/
http_RecvHead(hp, vc->fd, w->eb, NULL, NULL);
- event_base_loop(w->eb, 0);
- time(&sp->t_resp);
+ (void)event_base_loop(w->eb, 0);
+ sp->t_resp = time(NULL);
assert(http_DissectResponse(hp, vc->fd) == 0);
sp->vbc = vc;
sp->bkd_http = hp;
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <sbuf.h>
#include "libvarnish.h"
#include "shmlog.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
-#include <sbuf.h>
#include "libvarnish.h"
#include "shmlog.h"
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
-#include <sbuf.h>
#include "libvarnish.h"
#include "shmlog.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sbuf.h>
#include "libvarnish.h"
#include "heritage.h"
#include <stdio.h> /* XXX: for NULL ?? */
#include <sys/types.h>
#include <sys/time.h>
-#include <event.h>
#include "libvarnish.h"
-#include "sbuf.h"
#include "cache.h"
-e763 // Redundant declaration for symbol '...' previously declared
-e726 // Extraneous comma ignored
-e728 // Symbol ... not explicitly initialized
+-e716 // while(1) ...
+-e785 // Too few initializers for aggregate
+-emacro(740, TAILQ_PREV) // Unusual pointer cast (incompatible indirect types)
+-emacro((826), TAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small)
+
+
+-esym(534, printf) // Ignoring return value of function
-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, sbuf_printf) // Ignoring return value of function
+-esym(534, sbuf_cat) // Ignoring return value of function
// cache.h
-emacro(506, INCOMPL) // Constant value Boolean
+// cache_center.c
+-efunc(525, CNT_Session) // Negative indentation from line
+
// 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
+// storage_file.c
+
// Review all below this line
// -printf_code( H, void *, unsigned)
// -printf_code( jx, long long unsigned)
//
+-e767 // Macro redef (system queue.h vs ours )
+
+-e574 // Signed-unsigned mix with relational
+-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
// -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
//
//
// -e788 // enum constant 'HND_Unclass' not used within defaulted switch
//
-// -e716 // while(1) ...
//
// -e786 // String concatenation within initializer
#include <unistd.h>
#include <sys/wait.h>
-#include <queue.h>
+#include "queue.h"
#include <event.h>
#include <sbuf.h>
*/
static void
-std_rdcb(struct bufferevent *bev, void *arg __unused)
+std_rdcb(struct bufferevent *bev, void *arg)
{
const char *p;
+ (void)arg;
+
while (1) {
p = evbuffer_readline(bev->input);
if (p == NULL)
std_wrcb(struct bufferevent *bev, void *arg)
{
- printf("%s(%p, %p)\n", __func__, (void*)bev, arg);
+ printf("%s(%p, %p)\n",
+ (const char *)__func__, (void*)bev, arg);
exit (2);
}
std_excb(struct bufferevent *bev, short what, void *arg)
{
- printf("%s(%p, %d, %p)\n", __func__, (void*)bev, what, arg);
+ printf("%s(%p, %d, %p)\n",
+ (const char *)__func__, (void*)bev, what, arg);
exit (2);
}
cli_encode_string(child_cli1->output, cr->argv[u]);
}
evbuffer_add_printf(child_cli1->output, "\n");
- bufferevent_enable(child_cli1, EV_WRITE);
+ AZ(bufferevent_enable(child_cli1, EV_WRITE));
}
void
}
static void
-cli_rdcb(struct bufferevent *bev, void *arg __unused)
+cli_rdcb(struct bufferevent *bev, void *arg)
{
const char *p;
char **av;
struct creq *cr;
+ (void)arg;
+
p = evbuffer_readline(bev->input);
if (p == NULL)
return;
cli_excb(struct bufferevent *bev, short what, void *arg)
{
- printf("%s(%p, %d, %p)\n", __func__, (void*)bev, what, arg);
+ printf("%s(%p, %d, %p)\n",
+ (const char *)__func__, (void*)bev, what, arg);
exit (2);
}
/*--------------------------------------------------------------------*/
static void
-child_pingpong_ccb(unsigned u __unused, const char *r __unused, void *priv __unused)
+child_pingpong_ccb(unsigned u, const char *r, void *priv)
{
+ (void)u;
+ (void)r;
+ (void)priv;
+
/* XXX: reset keepalive timer */
}
static void
-child_pingpong(int a __unused, short b __unused, void *c __unused)
+child_pingpong(int a, short b, void *c)
{
time_t t;
struct timeval tv;
- time(&t);
+ (void)a;
+ (void)b;
+ (void)c;
+
+ t = time(NULL);
mgt_child_request(child_pingpong_ccb, NULL, NULL, "ping %ld", t);
if (1) {
tv.tv_sec = 10;
tv.tv_usec = 0;
- evtimer_del(&ev_child_pingpong);
- evtimer_add(&ev_child_pingpong, &tv);
+ AZ(evtimer_del(&ev_child_pingpong));
+ AZ(evtimer_add(&ev_child_pingpong, &tv));
}
}
child_std = bufferevent_new(child_fds[0],
std_rdcb, std_wrcb, std_excb, NULL);
assert(child_std != NULL);
- bufferevent_base_set(mgt_eb, child_std);
+ AZ(bufferevent_base_set(mgt_eb, child_std));
bufferevent_enable(child_std, EV_READ);
child_cli0 = bufferevent_new(heritage.fds[0],
cli_rdcb, cli_wrcb, cli_excb, NULL);
assert(child_cli0 != NULL);
- bufferevent_base_set(mgt_eb, child_cli0);
+ AZ(bufferevent_base_set(mgt_eb, child_cli0));
bufferevent_enable(child_cli0, EV_READ);
child_cli1 = bufferevent_new(heritage.fds[3],
cli_rdcb, cli_wrcb, cli_excb, NULL);
assert(child_cli1 != NULL);
- bufferevent_base_set(mgt_eb, child_cli1);
+ AZ(bufferevent_base_set(mgt_eb, child_cli1));
evtimer_set(&ev_child_pingpong, child_pingpong, NULL);
- event_base_set(mgt_eb, &ev_child_pingpong);
+ AZ(event_base_set(mgt_eb, &ev_child_pingpong));
child_pingpong(0, 0, NULL);
}
bufferevent_free(child_std); /* XXX: is this enough ? */
child_std = NULL;
- close(heritage.fds[0]);
- close(heritage.fds[1]);
- close(heritage.fds[2]);
- close(heritage.fds[3]);
- close(child_fds[0]);
- close(child_fds[1]);
+ AZ(close(heritage.fds[0]));
+ AZ(close(heritage.fds[1]));
+ AZ(close(heritage.fds[2]));
+ AZ(close(heritage.fds[3]));
+ AZ(close(child_fds[0]));
+ AZ(close(child_fds[1]));
if (desired == H_START)
start_child();