]> err.no Git - varnish/commitdiff
More flexelinting.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 12 Jul 2006 22:52:08 +0000 (22:52 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 12 Jul 2006 22:52:08 +0000 (22:52 +0000)
No bugs so far.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@465 d4fa192b-c00b-0410-8231-f00ffab90ce4

14 files changed:
varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_acceptor.c
varnish-cache/bin/varnishd/cache_backend.c
varnish-cache/bin/varnishd/cache_ban.c
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_expire.c
varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/cache_http.c
varnish-cache/bin/varnishd/cache_pass.c
varnish-cache/bin/varnishd/cache_pipe.c
varnish-cache/bin/varnishd/cache_pool.c
varnish-cache/bin/varnishd/cache_response.c
varnish-cache/bin/varnishd/flint.lnt
varnish-cache/bin/varnishd/mgt_child.c

index 897a17c9c9fbcb71473ed9e612760a1479f297ac..885e222f239d9de6085143e1b70ee46b82dd716b 100644 (file)
@@ -5,8 +5,10 @@
 #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"
index 5fe575e2ee3ee85050b9ae516be6a9a985f26fbe..54695c0d7a000e9102c6103ac4b3ab07fa048170 100644 (file)
@@ -17,8 +17,6 @@
 
 #include <netdb.h>
 
-#include <sbuf.h>
-
 #include "config.h"
 #include "libvarnish.h"
 #include "heritage.h"
index fd6da9db6e89f3ffc6220f0f4731706362c72ca3..f049ce54525cafbdeef3ad88e2e508cc51ed71db 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/socket.h>
 
 #include <netdb.h>
-#include <sbuf.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
index 91e6a47a9bcd842d8a02e1b4e990578864cf5044..db9264df1f2a6f86679e3265cd600bd261706c31 100644 (file)
@@ -36,7 +36,7 @@ AddBan(const char *regexp)
        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;
@@ -71,9 +71,10 @@ BAN_CheckObject(struct object *o, const char *url)
 }
 
 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]);
 }
index 7f8ad30ddcdf738e99d803be65eac0ace9d768a3..67f66a9d9de49c41b7cd77181b7e7dd9d794ac0a 100644 (file)
@@ -33,10 +33,7 @@ DOT start -> RECV
 #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"
@@ -521,7 +518,7 @@ void
 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; ) {
index c355e1cfe4b8cba170b066ca5b395ae32c4ff183..b44280994a93492109c01f3c40166ee6afd9514b 100644 (file)
@@ -43,13 +43,15 @@ EXP_TTLchange(struct object *o)
  */
 
 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)
@@ -64,7 +66,7 @@ exp_hangman(void *arg __unused)
                }
                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);
@@ -84,19 +86,21 @@ exp_hangman(void *arg __unused)
  */
 
 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);
@@ -121,20 +125,23 @@ exp_prefetch(void *arg __unused)
 /*--------------------------------------------------------------------*/
 
 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;
 }
 
index 5ac9bcb0baa89535d4a88a49c0771707f72b70bf..c0e8a45438351376a4d962d4f92b36e6efc82dfa 100644 (file)
@@ -12,7 +12,6 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
-#include <sbuf.h>
 
 #include "libvarnish.h"
 #include "shmlog.h"
@@ -29,8 +28,9 @@
 #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;
@@ -70,7 +70,7 @@ fetch_straight(struct sess *sp, int fd, struct http *hp, char *b)
 /* 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;
@@ -180,7 +180,7 @@ fetch_chunked(struct sess *sp, int fd, struct http *hp)
 #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;
@@ -222,7 +222,7 @@ fetch_eof(struct sess *sp, int fd, struct http *hp)
                sp->obj->len += i;
        }
 
-       if (st != NULL && stevedore->trim != NULL)
+       if (stevedore->trim != NULL)
                stevedore->trim(st, st->len);
 
        return (1);
@@ -294,7 +294,7 @@ FetchHeaders(struct worker *w, struct sess *sp)
        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 ?? */
 
@@ -303,8 +303,8 @@ FetchHeaders(struct worker *w, struct sess *sp)
         * 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;
index bd29e859d0c92399c15265bea776a3e3055932e7..7a080fc01df49b86ff10ec9c76bc9ffa4bdd1326 100644 (file)
@@ -9,7 +9,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <sbuf.h>
 
 #include "libvarnish.h"
 #include "shmlog.h"
index 70a870c42ef3b0009ac75e55a57cec2e38e3f799..7c3489d2b3a42b8a13ddefd908236d6d1f9bb521 100644 (file)
@@ -11,7 +11,6 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
-#include <sbuf.h>
 
 #include "libvarnish.h"
 #include "shmlog.h"
index 53a0d75bce49413ce1a16dfad6a8441e0a03ad1e..dc42cd070ec54b90252aad8539119a10e7bbba81 100644 (file)
@@ -7,7 +7,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/socket.h>
-#include <sbuf.h>
 
 #include "libvarnish.h"
 #include "shmlog.h"
index f7f466f2120d51ac9bbfb8b924ac4d502c101a2d..e302fbf77fcc068ff20bc7aed943e711c7089e4c 100644 (file)
@@ -9,7 +9,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sbuf.h>
 
 #include "libvarnish.h"
 #include "heritage.h"
index 554867fbef23db99926255310b96dfbced569811..458a5017375d87c9faacd25432024fb2bb9dff0d 100644 (file)
@@ -5,10 +5,8 @@
 #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"
 
 
index 9969c0857b6a71d512e2a4ab04f53514e9db7b94..df82fe7a737115868da29e6750be743c3963987d 100644 (file)
@@ -6,19 +6,33 @@
 -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
 // 
@@ -59,6 +74,5 @@
 // 
 // -e788       // enum constant 'HND_Unclass' not used within defaulted switch
 // 
-// -e716       // while(1) ... 
 // 
 // -e786       // String concatenation within initializer
index 410c45276f993551e178cfc22f32ae49d0375f1e..b3ca735023493d7a148f0de42c0d66894107412d 100644 (file)
@@ -16,7 +16,7 @@
 #include <unistd.h>
 
 #include <sys/wait.h>
-#include <queue.h>
+#include "queue.h"
 
 #include <event.h>
 #include <sbuf.h>
@@ -58,10 +58,12 @@ static TAILQ_HEAD(,creq)    creqhead = TAILQ_HEAD_INITIALIZER(creqhead);
  */
 
 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)
@@ -74,7 +76,8 @@ static void
 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);
 }
 
@@ -82,7 +85,8 @@ static void
 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);
 }
 
@@ -107,7 +111,7 @@ send_req(void)
                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
@@ -132,12 +136,14 @@ mgt_child_request(mgt_ccb_f *func, void *priv, char **argv, const char *fmt, ...
 }
 
 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;
@@ -167,32 +173,41 @@ static void
 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));
        }
 }
 
@@ -237,22 +252,22 @@ start_child(void)
        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);
 }
 
@@ -312,12 +327,12 @@ mgt_sigchld(int a, short b, void *c)
        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();