]> err.no Git - varnish/commitdiff
Go through all asserts and mark those which indicate missing code with
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 24 Aug 2006 07:57:07 +0000 (07:57 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 24 Aug 2006 07:57:07 +0000 (07:57 +0000)
xxx or XXX.

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

31 files changed:
varnish-cache/bin/varnishd/cache_acceptor.c
varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
varnish-cache/bin/varnishd/cache_acceptor_poll.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_cli.c
varnish-cache/bin/varnishd/cache_expire.c
varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/cache_hash.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/cache_session.c
varnish-cache/bin/varnishd/cache_vcl.c
varnish-cache/bin/varnishd/cache_vrt.c
varnish-cache/bin/varnishd/cache_vrt_acl.c
varnish-cache/bin/varnishd/cache_vrt_re.c
varnish-cache/bin/varnishd/flint.lnt
varnish-cache/bin/varnishd/hash_classic.c
varnish-cache/bin/varnishd/hash_simple_list.c
varnish-cache/bin/varnishd/mgt_child.c
varnish-cache/bin/varnishd/mgt_cli.c
varnish-cache/bin/varnishd/mgt_param.c
varnish-cache/bin/varnishd/mgt_vcc.c
varnish-cache/bin/varnishd/shmlog.c
varnish-cache/bin/varnishd/storage_file.c
varnish-cache/bin/varnishd/storage_malloc.c
varnish-cache/bin/varnishd/varnishd.c

index c62601820fe6c1843e67c8f1d5ff91828ec492a5..fa77bf4a4542e93bbd07c666a73599a4bec1ec0f 100644 (file)
@@ -63,7 +63,7 @@ vca_accept_sess(int fd)
                return (NULL);
        }
        sp = SES_New(addr, l);
-       assert(sp != NULL);     /* XXX handle */
+       XXXAN(sp);
 
        (void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
        sp->fd = i;
@@ -156,8 +156,8 @@ vca_return_session(struct sess *sp)
 {
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-       assert(sp->obj == NULL);
-       assert(sp->vcl == NULL);
+       AZ(sp->obj);
+       AZ(sp->vcl);
        if (sp->fd >= 0) {
                VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port);
                (void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
index e6e62803d6e3d56e6407199cbf867ed5ef6bc0a7..ec4ea5374949bc20e96dd26cf89228f271dbbe88 100644 (file)
@@ -32,14 +32,12 @@ static void
 vca_kq_sess(struct sess *sp, int arm)
 {
        struct kevent ke;
-       int i;
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        if (sp->fd < 0)
                return;
        EV_SET(&ke, sp->fd, EVFILT_READ, arm, 0, 0, sp);
-       i = kevent(kq, &ke, 1, NULL, 0, NULL);
-       assert(i == 0);
+       AZ(kevent(kq, &ke, 1, NULL, 0, NULL));
 }
 
 static void
@@ -48,7 +46,7 @@ vca_kev(struct kevent *kp)
        int i;
        struct sess *sp;
 
-       assert(kp->udata != NULL);
+       AN(kp->udata);
        if (kp->udata == pipes) {
                while (kp->data > 0) {
                        i = read(pipes[0], &sp, sizeof sp);
@@ -89,7 +87,7 @@ static void *
 vca_kqueue_main(void *arg)
 {
        struct kevent ke[NKEV], *kp;
-       int i, j, n;
+       int j, n;
        struct timespec ts;
        struct sess *sp;
 
@@ -101,8 +99,7 @@ vca_kqueue_main(void *arg)
        j = 0;
        EV_SET(&ke[j++], 0, EVFILT_TIMER, EV_ADD, 0, 100, NULL);
        EV_SET(&ke[j++], pipes[0], EVFILT_READ, EV_ADD, 0, 0, pipes);
-       i = kevent(kq, ke, j, NULL, 0, NULL);
-       assert(i == 0);
+       AZ(kevent(kq, ke, j, NULL, 0, NULL));
 
        while (1) {
                n = kevent(kq, NULL, 0, ke, NKEV, NULL);
index 298c5c5806cffab9c2b277ab86d71995837f2053..d0dcd7a886361734859cb78abaf8d03fde9bd688 100644 (file)
@@ -44,7 +44,7 @@ vca_pollspace(int fd)
                u += u;
        VSL(SLT_Debug, 0, "Acceptor Pollspace %u", u);
        p = realloc(pollfd, u * sizeof *p);
-       assert(p != NULL);
+       XXXAN(p);       /* close offending fd */
        memset(p + npoll, 0, (u - npoll) * sizeof *p);
        for (v = npoll ; v <= u; v++) 
                p->fd = -1;
index 950be40663f40bfa308732469d04a6bde5cbc39e..674d11ed6f0e8e3d32befc9ed8f91d54763872f5 100644 (file)
@@ -151,8 +151,8 @@ vbe_connect(struct backend *bp)
        char pbuf1[TCP_PORTBUFSIZE], pbuf2[TCP_PORTBUFSIZE];
        struct addrinfo *ai;
 
-       assert(bp != NULL);
-       assert(bp->hostname != NULL);
+       CHECK_OBJ_NOTNULL(bp, BACKEND_MAGIC);
+       AN(bp->hostname);
 
        s = vbe_conn_try(bp, &ai);
        if (s < 0) 
@@ -217,14 +217,14 @@ VBE_GetFd(struct backend *bp, unsigned xid)
                        vc = vbe_new_conn();
                else
                        vc = vc2;
-               assert(vc != NULL);
+               AN(vc);
                assert(vc->fd == -1);
-               assert(vc->backend == NULL);
+               AZ(vc->backend);
        }
 
        /* If not connected yet, do so */
        if (vc->fd < 0) {
-               assert(vc->backend == NULL);
+               AZ(vc->backend);
                vc->fd = vbe_connect(bp);
                LOCK(&vbemtx);
                if (vc->fd < 0) {
@@ -244,7 +244,7 @@ VBE_GetFd(struct backend *bp, unsigned xid)
                assert(vc->fd >= 0);
                VSL_stats->backend_conn++;
                VSL(SLT_BackendXID, vc->fd, "%u", xid);
-               assert(vc->backend != NULL);
+               AN(vc->backend);
        }
        return (vc);
 }
@@ -257,7 +257,7 @@ VBE_ClosedFd(struct vbe_conn *vc, int already)
 
        CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC);
        assert(vc->fd >= 0);
-       assert(vc->backend != NULL);
+       AN(vc->backend);
        VSL(SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name);
        if (!already)
                AZ(close(vc->fd));
@@ -277,7 +277,7 @@ VBE_RecycleFd(struct vbe_conn *vc)
 
        CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC);
        assert(vc->fd >= 0);
-       assert(vc->backend != NULL);
+       AN(vc->backend);
        VSL_stats->backend_recycle++;
        VSL(SLT_BackendReuse, vc->fd, "%s", vc->backend->vcl_name);
        LOCK(&vbemtx);
index db9264df1f2a6f86679e3265cd600bd261706c31..ebd4311073a38a1331a887f43357c3250a6f464b 100644 (file)
@@ -30,7 +30,7 @@ AddBan(const char *regexp)
        int i;
 
        b = calloc(sizeof *b, 1);
-       assert(b != NULL);
+       XXXAN(b);
 
        i = regcomp(&b->regexp, regexp, REG_EXTENDED | REG_NOSUB);
        if (i) {
index cce8898f0d0ed2e224c87b118dcae3909377413e..b4a3565e8373cbcef4bb126b4c7be58a2e07b088 100644 (file)
@@ -95,8 +95,8 @@ cnt_done(struct sess *sp)
        double dh, dp, da;
        struct timespec te;
 
-       assert(sp->obj == NULL);
-       assert(sp->vbc == NULL);
+       AZ(sp->obj);
+       AZ(sp->vbc);
        if (sp->fd >= 0 && sp->doclose != NULL)
                vca_close_session(sp, sp->doclose);
        sp->backend = NULL;
@@ -194,7 +194,7 @@ static int
 cnt_fetch(struct sess *sp)
 {
 
-       assert(sp->vbc != NULL);
+       CHECK_OBJ_NOTNULL(sp->vbc, VBE_CONN_MAGIC);
        RFC2616_cache_policy(sp, sp->vbc->http);
 
        VCL_fetch_method(sp);
@@ -220,9 +220,8 @@ cnt_fetch(struct sess *sp)
        }
        if (sp->handling == VCL_RET_INSERT) {
                sp->obj->cacheable = 1;
-               assert(sp->vbc != NULL);
                FetchBody(sp);
-               assert(sp->vbc == NULL);
+               AZ(sp->vbc);
                HSH_Ref(sp->obj); /* get another, STP_DELIVER will deref */
                HSH_Unbusy(sp->obj);
                sp->wrk->acct.fetch++;
@@ -362,7 +361,7 @@ static int
 cnt_lookup(struct sess *sp)
 {
 
-       assert(sp->obj == NULL);
+       AZ(sp->obj);
        sp->step = STP_LOOKUP2;
        return (0);
 }
@@ -469,10 +468,10 @@ cnt_miss(struct sess *sp)
        if (sp->handling == VCL_RET_LOOKUP)
                INCOMPL();
        if (sp->handling == VCL_RET_FETCH) {
-               assert(sp->vbc == NULL);
+               AZ(sp->vbc);
                FetchHeaders(sp);
                sp->step = STP_FETCH;
-               assert(sp->vbc != NULL);
+               AN(sp->vbc);
                return (0);
        }
        INCOMPL();
@@ -497,9 +496,9 @@ static int
 cnt_pass(struct sess *sp)
 {
 
-       assert(sp->vbc == NULL);
+       AZ(sp->vbc);
        if (!PassSession(sp)) {
-               assert(sp->vbc != NULL);
+               AN(sp->vbc);
                sp->step = STP_PASSBODY;
        } else 
                sp->step = STP_DONE;
@@ -526,9 +525,9 @@ cnt_passbody(struct sess *sp)
 {
 
        sp->wrk->acct.pass++;
-       assert(sp->vbc != NULL);
+       AN(sp->vbc);
        PassBody(sp);
-       assert(sp->vbc == NULL);
+       AZ(sp->vbc);
        sp->step = STP_DONE;
        return (0);
 }
@@ -591,11 +590,11 @@ cnt_recv(struct sess *sp)
        int done;
 
        sp->t0 = time(NULL);
-       assert(sp->vcl == NULL);
+       AZ(sp->vcl);
        sp->vcl = VCL_Get();
 
-       assert(sp->obj == NULL);
-       assert(sp->vbc == NULL);
+       AZ(sp->obj);
+       AZ(sp->vbc);
 
        sp->wrk->acct.req++;
        done = http_DissectRequest(sp->http, sp->fd);
index d244c5fcdc5f41bcefa0120ae7283b999eed0465..fd8ff6c0d4f23fbf6071d907e4ce24311dd5e243 100644 (file)
@@ -65,10 +65,10 @@ CLI_Init(void)
        memset(cli, 0, sizeof *cli);
        
        cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-       assert(cli->sb != NULL);
+       XXXAN(cli->sb);
        lbuf = 4096;
        buf = malloc(lbuf);
-       assert(buf != NULL);
+       XXXAN(buf);
        nbuf = 0;
        while (1) {
                pfd[0].fd = heritage.fds[2];
@@ -79,7 +79,7 @@ CLI_Init(void)
                if ((nbuf + 2) >= lbuf) {
                        lbuf += lbuf;
                        buf = realloc(buf, lbuf);
-                       assert(buf != NULL);
+                       XXXAN(buf);
                }
                i = read(heritage.fds[2], buf + nbuf, lbuf - nbuf);
                if (i <= 0) {
index f65a68e0958459058dc2edb7e81d7f8810aadfe9..33f0a5e6a1852fcf7bdff4c3ddf505de4137243a 100644 (file)
@@ -110,7 +110,7 @@ exp_prefetch(void *arg)
        (void)arg;
 
        sp = SES_New(NULL, 0);
-       assert(sp != NULL);
+       XXXAN(sp);
        while (1) {
                t = time(NULL);
                LOCK(&exp_mtx);
@@ -179,7 +179,7 @@ EXP_Init(void)
 
        AZ(pthread_mutex_init(&exp_mtx, NULL));
        exp_heap = binheap_new(NULL, object_cmp, object_update);
-       assert(exp_heap != NULL);
+       XXXAN(exp_heap);
        AZ(pthread_create(&exp_thread, NULL, exp_prefetch, NULL));
        AZ(pthread_create(&exp_thread, NULL, exp_hangman, NULL));
 }
index cf7525b7dd932611842452aeae975fe5e8d398d3..08a5fa63e05a2a9e00ecd263889e4a8cd4c38a26 100644 (file)
@@ -40,7 +40,7 @@ fetch_straight(const struct sess *sp, int fd, struct http *hp, char *b)
        cl = strtoumax(b, NULL, 0);
 
        st = stevedore->alloc(stevedore, cl);
-       assert(st->stevedore != NULL);
+       XXXAN(st->stevedore);
        TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
        st->len = cl;
        sp->obj->len = cl;
@@ -52,7 +52,7 @@ fetch_straight(const struct sess *sp, int fd, struct http *hp, char *b)
 
        while (cl > 0) {
                i = http_Read(hp, fd, p, cl);
-               assert(i > 0);  /* XXX seen */
+               xxxassert(i > 0);       /* XXX seen */
                p += i;
                cl -= i;
        }
@@ -82,18 +82,18 @@ fetch_chunked(const struct sess *sp, int fd, struct http *hp)
        st = NULL;
        while (1) {
                i = http_Read(hp, fd, bp, be - bp);
-               assert(i >= 0);
+               xxxassert(i >= 0);
                bp += i;
                *bp = '\0';
                u = strtoul(buf, &q, 16);
                if (q == NULL || q == buf)
                        continue;
-               assert(isspace(*q));
+               xxxassert(isspace(*q));
                while (*q == '\t' || *q == ' ')
                        q++;
                if (*q == '\r')
                        q++;
-               assert(*q == '\n');
+               xxxassert(*q == '\n');
                q++;
                if (u == 0)
                        break;
@@ -105,7 +105,7 @@ fetch_chunked(const struct sess *sp, int fd, struct http *hp)
                        } else {
                                st = stevedore->alloc(stevedore,
                                    stevedore->trim == NULL ? u : CHUNK_PREALLOC);
-                               assert(st->stevedore != NULL);
+                               XXXAN(st->stevedore);
                                TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
                                p = st->ptr;
                        }
@@ -114,9 +114,9 @@ fetch_chunked(const struct sess *sp, int fd, struct http *hp)
                                v = u;
 
                        i = bp - q;
+                       assert(i >= 0);
                        if (i == 0) {
                        } else if (v > i) {
-                               assert(i > 0);
                                memcpy(p, q, i);
                                p += i;
                                st->len += i;
@@ -141,7 +141,6 @@ fetch_chunked(const struct sess *sp, int fd, struct http *hp)
                                continue;
                        while (v > 0) {
                                i = http_Read(hp, fd, p, v);
-                               assert(i > 0);
                                st->len += i;
                                v -= i;
                                u -= i;
@@ -178,15 +177,15 @@ fetch_eof(const struct sess *sp, int fd, struct http *hp)
        while (1) {
                if (v == 0) {
                        st = stevedore->alloc(stevedore, CHUNK_PREALLOC);
-                       assert(st->stevedore != NULL);
+                       XXXAN(st->stevedore);
                        TAILQ_INSERT_TAIL(&sp->obj->store, st, list);
                        p = st->ptr + st->len;
                        v = st->space - st->len;
                }
-               assert(p != NULL);
-               assert(st != NULL);
+               AN(p);
+               AN(st);
                i = http_Read(hp, fd, p, v);
-               assert(i >= 0);
+               xxxassert(i >= 0);
                if (i == 0)
                     break;
                p += i;
@@ -286,7 +285,7 @@ FetchHeaders(struct sess *sp)
        vc = VBE_GetFd(sp->backend, sp->xid);
        if (vc == NULL)
                vc = VBE_GetFd(sp->backend, sp->xid);
-       assert(vc != NULL);     /* XXX: handle this */
+       XXXAN(vc);
        VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
        http_ClrHeader(vc->http);
@@ -302,19 +301,19 @@ FetchHeaders(struct sess *sp)
        WRK_Reset(w, &vc->fd);
        http_Write(w, vc->http, 0);
        i = WRK_Flush(w);
-       assert(i == 0);
+       xxxassert(i == 0);
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
        CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
 
        i = http_RecvHead(vc->http, vc->fd);
-       assert(i == 0);
-       assert(http_DissectResponse(vc->http, vc->fd) == 0);
+       xxxassert(i == 0);
+       xxxassert(http_DissectResponse(vc->http, vc->fd) == 0);
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
        CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
-       assert(sp->vbc == NULL);
+       AZ(sp->vbc);
        sp->vbc = vc;
 
        sp->obj->entered = time(NULL);
index 0a5ac84e037670b420e6e1439be80b8e0bd198e3..54010656040521bf80a65d227dbf69faefc1ee66 100644 (file)
@@ -50,14 +50,14 @@ HSH_Lookup(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
        CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC);
-       assert(hash != NULL);
+       AN(hash);
        w = sp->wrk;
        h = sp->http;
 
        /* Precreate an objhead and object in case we need them */
        if (w->nobjhead == NULL) {
                w->nobjhead = calloc(sizeof *w->nobjhead, 1);
-               assert(w->nobjhead != NULL);
+               XXXAN(w->nobjhead);
                w->nobjhead->magic = OBJHEAD_MAGIC;
                TAILQ_INIT(&w->nobjhead->objects);
                AZ(pthread_mutex_init(&w->nobjhead->mtx, NULL));
@@ -66,7 +66,7 @@ HSH_Lookup(struct sess *sp)
                CHECK_OBJ_NOTNULL(w->nobjhead, OBJHEAD_MAGIC);
        if (w->nobj == NULL) {
                w->nobj = calloc(sizeof *w->nobj, 1);
-               assert(w->nobj != NULL);
+               XXXAN(w->nobj);
                w->nobj->magic = OBJECT_MAGIC;
                w->nobj->http.magic = HTTP_MAGIC;
                w->nobj->busy = 1;
@@ -139,7 +139,7 @@ HSH_Unbusy(struct object *o)
 {
        struct sess *sp;
 
-       assert(o != NULL);
+       CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
        assert(o->busy);
        assert(o->refcnt > 0);
        if (o->cacheable)
index 934ff5da4d5f89935e69374e66075e6f1fe4592d..265e0f152d590e804f8f0f2d4fc224dc92fc4c1a 100644 (file)
@@ -87,9 +87,9 @@ http_IsHdr(struct http_hdr *hh, char *hdr)
 {
        unsigned l;
 
-       assert(hh->b != NULL);
-       assert(hh->e != NULL);
-       assert(hdr != NULL);
+       AN(hh->b);
+       AN(hh->e);
+       AN(hdr);
        l = hdr[0];
        assert(l == strlen(hdr + 1));
        assert(hdr[l] == ':');
@@ -105,8 +105,8 @@ http_findhdr(struct http *hp, unsigned l, const char *hdr)
        unsigned u;
 
        for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
-               assert(hp->hd[u].b != NULL);
-               assert(hp->hd[u].e != NULL);
+               AN(hp->hd[u].b);
+               AN(hp->hd[u].e);
                if (hp->hd[u].e < hp->hd[u].b + l + 1)
                        continue;
                if (hp->hd[u].b[l] != ':')
@@ -221,7 +221,7 @@ http_HdrIs(struct http *hp, const char *hdr, const char *val)
 
        if (!http_GetHdr(hp, hdr, &p))
                return (0);
-       assert(p != NULL);
+       AN(p);
        if (!strcasecmp(p, val))
                return (1);
        return (0);
@@ -285,7 +285,7 @@ int
 http_GetStatus(struct http *hp)
 {
 
-       assert(hp->hd[HTTP_HDR_STATUS].b != NULL);
+       AN(hp->hd[HTTP_HDR_STATUS].b);
        return (strtoul(hp->hd[HTTP_HDR_STATUS].b,
            NULL /* XXX */, 10));
 }
@@ -346,7 +346,8 @@ http_DissectRequest(struct http *hp, int fd)
 {
        char *p;
 
-       assert(hp->t != NULL);
+       CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
+       AN(hp->t);
        assert(hp->s < hp->t);
        assert(hp->t <= hp->v);
        hp->logtag = HTTP_Rx;
@@ -412,7 +413,8 @@ http_DissectResponse(struct http *hp, int fd)
 {
        char *p, *q;
 
-       assert(hp->t != NULL);
+       CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
+       AN(hp->t);
        assert(hp->s < hp->t);
        assert(hp->t <= hp->v);
        hp->logtag = HTTP_Rx;
@@ -462,6 +464,7 @@ http_header_complete(struct http *hp)
 {
        char *p;
 
+       CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
        assert(hp->v <= hp->e);
        assert(*hp->v == '\0');
        /* Skip any leading white space */
@@ -595,17 +598,17 @@ http_CopyHttp(struct http *to, struct http *fm)
        for (u = 0; u < fm->nhd; u++) {
                if (fm->hd[u].b == NULL)
                        continue;
-               assert(fm->hd[u].e != NULL);
+               AN(fm->hd[u].e);
                l += (fm->hd[u].e - fm->hd[u].b) + 1;
        }
        to->s = malloc(l);
-       assert(to->s != NULL);
+       XXXAN(to->s);
        to->e = to->s + l;
        to->f = to->s;
        for (u = 0; u < fm->nhd; u++) {
                if (fm->hd[u].b == NULL)
                        continue;
-               assert(fm->hd[u].e != NULL);
+               AN(fm->hd[u].e);
                assert(*fm->hd[u].e == '\0');
                l = fm->hd[u].e - fm->hd[u].b;
                assert(l == strlen(fm->hd[u].b));
@@ -623,8 +626,9 @@ http_CopyHttp(struct http *to, struct http *fm)
 static void
 http_seth(int fd, struct http *to, unsigned n, enum httptag tag, const char *fm)
 {
+
        assert(n < HTTP_HDR_MAX);
-       assert(fm != NULL);
+       AN(fm);
        to->hd[n].b = (void*)(uintptr_t)fm;
        to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0');
        to->hdf[n] = 0;
@@ -636,7 +640,7 @@ http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum httptag ta
 {
 
        assert(n < HTTP_HDR_MAX);
-       assert(fm->hd[n].b != NULL);
+       AN(fm->hd[n].b);
        to->hd[n].b = fm->hd[n].b;
        to->hd[n].e = fm->hd[n].e;
        to->hdf[n] = fm->hdf[n];
@@ -693,7 +697,7 @@ http_copyheader(int fd, struct http *to, struct http *fm, unsigned n)
        CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
        CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
        assert(n < HTTP_HDR_MAX);
-       assert(fm->hd[n].b != NULL);
+       AN(fm->hd[n].b);
        if (to->nhd < HTTP_HDR_MAX) {
                to->hd[to->nhd].b = fm->hd[n].b;
                to->hd[to->nhd].e = fm->hd[n].e;
@@ -788,19 +792,19 @@ http_Write(struct worker *w, struct http *hp, int resp)
        unsigned u, l;
 
        if (resp) {
-               assert(hp->hd[HTTP_HDR_STATUS].b != NULL);
+               AN(hp->hd[HTTP_HDR_STATUS].b);
                l = WRK_WriteH(w, &hp->hd[HTTP_HDR_PROTO], " ");
                l += WRK_WriteH(w, &hp->hd[HTTP_HDR_STATUS], " ");
                l += WRK_WriteH(w, &hp->hd[HTTP_HDR_RESPONSE], "\r\n");
        } else {
-               assert(hp->hd[HTTP_HDR_URL].b != NULL);
+               AN(hp->hd[HTTP_HDR_URL].b);
                l = WRK_WriteH(w, &hp->hd[HTTP_HDR_REQ], " ");
                l += WRK_WriteH(w, &hp->hd[HTTP_HDR_URL], " ");
                l += WRK_WriteH(w, &hp->hd[HTTP_HDR_PROTO], "\r\n");
        }
        for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
-               assert(hp->hd[u].b != NULL);
-               assert(hp->hd[u].e != NULL);
+               AN(hp->hd[u].b);
+               AN(hp->hd[u].e);
                l += WRK_WriteH(w, &hp->hd[u], "\r\n");
        }
        l += WRK_Write(w, "\r\n", -1);
index ead16da0cefeecf42f58e5b3af02824409ce5868..c116cfb2edbd8470673ea3aea64f09ef9290786f 100644 (file)
@@ -49,7 +49,6 @@ pass_straight(struct sess *sp, int fd, struct http *hp, char *bi)
                        vca_close_session(sp, "backend closed");
                        return (1);
                }
-               assert(i > 0);
                sp->wrk->acct.bodybytes += WRK_Write(sp->wrk, buf, i);
                if (WRK_Flush(sp->wrk))
                        vca_close_session(sp, "remote closed");
@@ -79,7 +78,7 @@ pass_chunked(struct sess *sp, int fd, struct http *hp)
        p = buf;
        while (1) {
                i = http_Read(hp, fd, bp, be - bp);
-               assert(i >= 0);
+               xxxassert(i >= 0);
                if (i == 0 && p == bp)
                        break;
                bp += i;
@@ -131,7 +130,7 @@ pass_chunked(struct sess *sp, int fd, struct http *hp)
                        if (j > be - bp)
                                j = be - bp;
                        i = http_Read(hp, fd, bp, j);
-                       assert(i > 0);
+                       xxxassert(i > 0);
                        bp += i;
                }
        }
@@ -150,8 +149,9 @@ PassBody(struct sess *sp)
        char *b;
        int cls;
 
+       CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+       CHECK_OBJ_NOTNULL(sp->vbc, VBE_CONN_MAGIC);
        vc = sp->vbc;
-       assert(vc != NULL);
        sp->vbc = NULL;
 
        clock_gettime(CLOCK_REALTIME, &sp->t_resp);
@@ -207,7 +207,6 @@ PassSession(struct sess *sp)
                RES_Error(sp, 503, "Backend did not respond.");
                return (1);
        }
-       assert(vc != NULL);
        VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
        http_CopyReq(vc->fd, vc->http, sp->http);
@@ -216,12 +215,12 @@ PassSession(struct sess *sp)
        WRK_Reset(w, &vc->fd);
        http_Write(w, vc->http, 0);
        i = WRK_Flush(w);
-       assert(i == 0);
+       xxxassert(i == 0);
 
        /* XXX: copy any contents */
 
        i = http_RecvHead(vc->http, vc->fd);
-       assert(i == 0);
+       xxxassert(i == 0);
        http_DissectResponse(vc->http, vc->fd);
 
        assert(sp->vbc == NULL);
index 99749a7f66dff2e1aada41d2b1046d7021a499a1..408399347232d3359cc180436ad927df34893540 100644 (file)
@@ -58,7 +58,6 @@ PipeSession(struct sess *sp)
                RES_Error(sp, 503, "Backend did not respond.");
                return;
        }
-       assert(vc != NULL);
        VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
        vc->http->logtag = HTTP_Tx;
 
index 234422804b28a1b91ae00e3ed8627b58a7437b1f..bfc2ed6d3199f20a687f2b78b9ddc9553a4c936a 100644 (file)
@@ -69,10 +69,10 @@ WRK_WriteH(struct worker *w, struct http_hdr *hh, const char *suf)
        unsigned u;
        
        CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
-       assert(w != NULL);
-       assert(hh != NULL);
-       assert(hh->b != NULL);
-       assert(hh->e != NULL);
+       AN(w);
+       AN(hh);
+       AN(hh->b);
+       AN(hh->e);
        u = WRK_Write(w, hh->b, hh->e - hh->b);
        if (suf != NULL)
                u += WRK_Write(w, suf, -1);
@@ -128,7 +128,7 @@ wrk_do_one(struct worker *w)
        struct workreq *wrq;
 
        wrq = TAILQ_FIRST(&wrk_reqhead);
-       assert(wrq != NULL);
+       AN(wrq);
        VSL_stats->n_wrk_busy++;
        TAILQ_REMOVE(&wrk_reqhead, wrq, list);
        VSL_stats->n_wrk_queue--;
index 73a70fec6d7eecc2d8b4f1aaeb7b091f5485052c..8d4f80320c569899daf8fa3980a088547f0dec30 100644 (file)
@@ -82,7 +82,7 @@ RES_Error(struct sess *sp, int code, const char *expl)
                }
 
        sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-       assert(sb != NULL);
+       XXXAN(sb);
        assert(code >= 100 && code <= 999);
 
        if (msg == NULL) {
@@ -226,7 +226,7 @@ RES_WriteObj(struct sess *sp)
                TAILQ_FOREACH(st, &sp->obj->store, list) {
                        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
                        CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
-                       assert(st->stevedore != NULL);
+                       AN(st->stevedore);
                        u += st->len;
                        sp->wrk->acct.bodybytes += st->len;
 #ifdef HAVE_SENDFILE
index f68a9e976bdefd9d9f2f63438855b670f0310d47..d663ad2873d8ef4f4b0db1f2b11f6b3d18891cab 100644 (file)
@@ -72,7 +72,7 @@ SES_RefSrcAddr(struct sess *sp)
        struct srcaddrhead *ch;
        time_t now;
 
-       assert(sp->srcaddr == NULL);
+       AZ(sp->srcaddr);
        for (u = 0, p = sp->addr; *p; p++)
                u += u + *p;
        v = u % CLIENT_HASH;
@@ -110,12 +110,12 @@ SES_RefSrcAddr(struct sess *sp)
        }
        if (c3 == NULL) {
                c3 = malloc(sizeof *c3);
-               assert(c3 != NULL);
+               XXXAN(c3);
                if (c3 != NULL)
                        VSL_stats->n_srcaddr++;
        } else
                TAILQ_REMOVE(ch, c3, list);
-       assert (c3 != NULL);
+       AN(c3);
        if (c3 != NULL) {
                memset(c3, 0, sizeof *c3);
                strcpy(c3->addr, sp->addr);
@@ -177,7 +177,7 @@ ses_relsrcaddr(struct sess *sp)
                /* If we never get to work pool (illegal req) */
                return;
        }
-       assert(sp->srcaddr != NULL);
+       AN(sp->srcaddr);
        LOCK(&ses_mtx);
        assert(sp->srcaddr->nref > 0);
        sp->srcaddr->nref--;
@@ -236,7 +236,7 @@ SES_New(struct sockaddr *addr, unsigned len)
        sm->sess.http = &sm->http;
 
        sm->sess.sockaddr = sm->sockaddr;
-       assert(len  < sizeof(sm->sockaddr));
+       assert(len < sizeof(sm->sockaddr));
        if (addr != NULL) {
                memcpy(sm->sess.sockaddr, addr, len);
                sm->sess.sockaddrlen = len;
@@ -259,8 +259,8 @@ SES_Delete(struct sess *sp)
        sm = sp->mem;
        CHECK_OBJ_NOTNULL(sm, SESSMEM_MAGIC);
        
-       assert(sp->obj == NULL);
-       assert(sp->vcl == NULL);
+       AZ(sp->obj);
+       AZ(sp->vcl);
        VSL_stats->n_sess--;
        ses_relsrcaddr(sp);
        VSL(SLT_StatSess, sp->id, "%s %s %d %ju %ju %ju %ju %ju %ju %ju",
index f9c11db6eaa33b8e767eae30554a5819ecf8379e..377ed4d93a0981d9df61bc36557dd249effc9e9b 100644 (file)
@@ -47,9 +47,9 @@ VCL_Get(void)
        struct VCL_conf *vc;
 
        LOCK(&vcl_mtx);
-       assert(vcl_active != NULL);
+       AN(vcl_active);
        vc = vcl_active->conf;
-       assert(vc != NULL);
+       AN(vc);
        vc->busy++;
        UNLOCK(&vcl_mtx);
        return (vc);
@@ -106,7 +106,7 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
        }
 
        vcl = calloc(sizeof *vcl, 1);
-       assert(vcl != NULL);
+       XXXAN(vcl);
 
        vcl->dlh = dlopen(fn, RTLD_NOW | RTLD_LOCAL);
 
@@ -140,7 +140,7 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
        }
        vcl->conf->priv = vcl;
        vcl->name = strdup(name);
-       assert(vcl->name != NULL);
+       XXXAN(vcl->name);
        TAILQ_INSERT_TAIL(&vcl_head, vcl, list);
        LOCK(&vcl_mtx);
        if (vcl_active == NULL)
index 14e089c093fc0e4f584204283ad17d796142d1ca..6933e752958624c4b32aaf88866bb305d5631a0f 100644 (file)
@@ -47,8 +47,7 @@ VRT_GetHdr(struct sess *sp, const char *n)
        char *p;
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-       assert(sp != NULL);
-       assert(sp->http != NULL);
+       AN(sp->http);
        if (!http_GetHdr(sp->http, n, &p))
                return (NULL);
        return (p);
@@ -80,10 +79,10 @@ VRT_alloc_backends(struct VCL_conf *cp)
        int i;
 
        cp->backend = calloc(sizeof *cp->backend, cp->nbackend);
-       assert(cp->backend != NULL);
+       XXXAN(cp->backend);
        for (i = 0; i < cp->nbackend; i++) {
                cp->backend[i] = calloc(sizeof *cp->backend[i], 1);
-               assert(cp->backend[i] != NULL);
+               XXXAN(cp->backend[i]);
                cp->backend[i]->magic = BACKEND_MAGIC;
                TAILQ_INIT(&cp->backend[i]->connlist);
        }
index 18160ab44d4f46458a4b39a8703db1eca6a82fd4..51bd3c86b69f0434433e165c93237c51512c3838 100644 (file)
@@ -34,7 +34,7 @@ static int
 vrt_acl_vsl(struct sess *sp, const char *acl, struct vrt_acl *ap, int r)
 {
 
-       assert(ap != NULL);
+       AN(ap);
        if (ap->name == NULL) {
                assert(r == 0);
                VSL(SLT_VCL_acl, sp->fd, "NO_MATCH %s", acl);
index 9c99700daf721280c7fe42e18eefe5906738b20f..f662212758315bf9765f16755186d2b422133a6b 100644 (file)
@@ -20,12 +20,11 @@ void
 VRT_re_init(void **rep, const char *re)
 {
        regex_t *t;
-       int i;
 
        t = calloc(sizeof *t, 1);
-       assert(t != NULL);
-       i = regcomp(t, re, REG_EXTENDED | REG_NOSUB);
-       assert(i == 0);
+       XXXAN(t);
+       /* This was already check-compiled by the VCL compiler */
+       AZ(regcomp(t, re, REG_EXTENDED | REG_NOSUB));
        *rep = t;
 }
 
@@ -45,7 +44,7 @@ VRT_re_match(const char *s, void *re)
 
        if (s == NULL)
                return (0);
-       assert(re != NULL);
+       AN(re);
        t = re;
        i = regexec(t, s, 0, NULL, 0);
        if (i == 0)
index 90867c4bd2e7a69b3dd036e039e1a226db359960..6c5f2b8af822b9a10e4916fbe3732986f0b5e2e9 100644 (file)
@@ -8,6 +8,7 @@
 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
 
 -sem(lbv_assert, r_no)
+-sem(lbv_xxxassert, r_no)
 
 -ffc   // No automatic custody
 
index f0eca583a98ca28ac2c67cd50ebe79013c1d20e0..fff108d7ecf217ae4e4195d2e62a070e554cbb9f 100644 (file)
@@ -142,7 +142,7 @@ hcl_start(void)
        unsigned u;
 
        hcl_head = calloc(sizeof *hcl_head, hcl_nhash);
-       assert(hcl_head != NULL);
+       XXXAN(hcl_head);
 
        for (u = 0; u < hcl_nhash; u++) {
                TAILQ_INIT(&hcl_head[u].head);
@@ -220,7 +220,7 @@ hcl_lookup(const char *key1, const char *key2, struct objhead *noh)
 
                i = sizeof *he2 + kl;
                he2 = calloc(i, 1);
-               assert(he2 != NULL);
+               XXXAN(he2);
                he2->magic = HCL_ENTRY_MAGIC;
                he2->oh = noh;
                he2->digest = digest;
index 69f3a241f4b88fd23bc8aad6e7b10a54c73f769e..b5a7e550363c4e1dd8e3d1263d3216b87c1c9a7e 100644 (file)
@@ -71,13 +71,13 @@ hsl_lookup(const char *key1, const char *key2, struct objhead *nobj)
                return (NULL);
        }
        he2 = calloc(sizeof *he2, 1);
-       assert(he2 != NULL);
+       XXXAN(he2);
        he2->obj = nobj;
        he2->refcnt = 1;
        he2->key1 = strdup(key1);
-       assert(he2->key1 != NULL);
+       XXXAN(he2->key1);
        he2->key2 = strdup(key2);
-       assert(he2->key2 != NULL);
+       XXXAN(he2->key2);
        nobj->hashpriv = he2;
        if (he != NULL)
                TAILQ_INSERT_BEFORE(he, he2, list);
@@ -97,7 +97,7 @@ hsl_deref(struct objhead *obj)
        struct hsl_entry *he;
        int ret;
 
-       assert(obj->hashpriv != NULL);
+       AN(obj->hashpriv);
        he = obj->hashpriv;
        LOCK(&hsl_mutex);
        if (--he->refcnt == 0) {
index 84a39de072210d0a249f36f32fd418309f8e130b..1bf7113d559462b9216ae2319447c497473ef2eb 100644 (file)
@@ -114,7 +114,7 @@ start_child(void)
                /* Redirect stdin/out/err */
                AZ(close(0));
                i = open("/dev/null", O_RDONLY);
-               assert(i == 0);
+               xxxassert(i == 0);
                assert(dup2(child_fds[1], 1) == 1);
                assert(dup2(child_fds[1], 2) == 2);
                AZ(close(child_fds[0]));
@@ -137,9 +137,9 @@ start_child(void)
        AZ(close(child_fds[1]));
        child_fds[1] = -1;
 
-       assert(ev_listen == NULL);
+       AZ(ev_listen);
        e = ev_new();
-       assert(e != NULL);
+       XXXAN(e);
        e->fd = child_fds[0];
        e->fd_flags = EV_RD;
        e->name = "Child listener";
@@ -147,9 +147,9 @@ start_child(void)
        AZ(ev_add(mgt_evb, e));
        ev_listen = e;
 
-       assert(ev_poker == NULL);
+       AZ(ev_poker);
        e = ev_new();
-       assert(e != NULL);
+       XXXAN(e);
        e->timeout = 3.0;
        e->callback = child_poker;
        e->name = "child poker";
@@ -287,7 +287,7 @@ mgt_run(int dflag, const char *T_arg)
        mgt_pid = getpid();
 
        mgt_evb = ev_new_base();
-       assert(mgt_evb != NULL);
+       XXXAN(mgt_evb);
 
        if (dflag)
                mgt_cli_setup(0, 1, 1);
@@ -296,21 +296,21 @@ mgt_run(int dflag, const char *T_arg)
                mgt_cli_telnet(T_arg);
 
        e = ev_new();
-       assert(e != NULL);
+       XXXAN(e);
        e->sig = SIGTERM;
        e->callback = mgt_sigint;
        e->name = "mgt_sigterm";
        AZ(ev_add(mgt_evb, e));
 
        e = ev_new();
-       assert(e != NULL);
+       XXXAN(e);
        e->sig = SIGINT;
        e->callback = mgt_sigint;
        e->name = "mgt_sigint";
        AZ(ev_add(mgt_evb, e));
 
        e = ev_new();
-       assert(e != NULL);
+       XXXAN(e);
        e->sig = SIGCHLD;
        e->sig_flags = SA_NOCLDSTOP;
        e->callback = mgt_sigchld;
index 51da8fef1555e42e8a0e52933ab803161ac81807..823abe4a53c85156cfe918d36655b9ebf1c0cac6 100644 (file)
@@ -40,7 +40,7 @@ mcf_stats(struct cli *cli, char **av, void *priv)
        (void)av;
        (void)priv;
 
-       assert (VSL_stats != NULL);
+       AN(VSL_stats);
 #define MAC_STAT(n,t,f,d) \
     cli_out(cli, "%12ju  " d "\n", (VSL_stats->n));
 #include "stat_field.h"
@@ -72,7 +72,7 @@ mcf_passthru(struct cli *cli, char **av, void *priv)
        for (u = 1; av[u] != NULL; u++)
                v += strlen(av[u]) + 3;
        p = malloc(v);
-       assert(p != NULL);
+       XXXAN(p);
        q = p;
        for (u = 1; av[u] != NULL; u++) {
                *q++ = '"';
@@ -90,7 +90,7 @@ mcf_passthru(struct cli *cli, char **av, void *priv)
        *q++ = '\n';
        v = q - p;
        i = write(cli_o, p, v);
-       assert(i == v);
+       xxxassert(i == v);
        free(p);
 
        i = cli_readres(cli_i, &u, &p, 3.0);
@@ -149,7 +149,7 @@ mgt_cli_init(void)
        for (cp = CLI_cmds; cp->request != NULL; cp++)
                u++;
        cli_proto = calloc(sizeof *cli_proto, u + 1);
-       assert(cli_proto != NULL);
+       XXXAN(cli_proto);
        u = 0;
        for (cp = mgt_cli_proto; cp->request != NULL; cp++)
                cli_proto[u++] = *cp;
@@ -268,7 +268,7 @@ mgt_cli_callback(struct ev *e, int what)
                if (cp->nbuf == cp->lbuf) {
                        cp->lbuf += cp->lbuf;
                        cp->buf = realloc(cp->buf, cp->lbuf);
-                       assert(cp->buf != NULL);
+                       XXXAN(cp->buf);
                }
                i = read(cp->fdi, cp->buf + cp->nbuf, cp->lbuf - cp->nbuf);
                if (i <= 0)
@@ -313,7 +313,7 @@ mgt_cli_setup(int fdi, int fdo, int verbose)
        struct cli_port *cp;
 
        cp = calloc(sizeof *cp, 1);
-       assert(cp != NULL);
+       XXXAN(cp);
 
        sprintf(cp->name, "cli %d->%d", fdi, fdo);
        cp->magic = CLI_PORT_MAGIC;
@@ -324,10 +324,10 @@ mgt_cli_setup(int fdi, int fdo, int verbose)
 
        cp->lbuf = 4096;
        cp->buf = malloc(cp->lbuf);
-       assert(cp->buf != NULL);
+       XXXAN(cp->buf);
 
        cp->cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-       assert(cp->cli->sb != NULL);
+       XXXAN(cp->cli->sb);
 
        cp->ev = calloc(sizeof *cp->ev, 1);
        cp->ev->name = cp->name;
@@ -370,7 +370,7 @@ mgt_cli_telnet(const char *T_arg)
                exit (2);
        }
        telnet_ev = ev_new();
-       assert(telnet_ev != NULL);
+       XXXAN(telnet_ev);
        telnet_ev->fd = telnet_sock;
        telnet_ev->fd_flags = POLLIN;
        telnet_ev->callback = telnet_accept;
index b358a8216f3e83cfad0a97556a789b2ba1adb825..cb8de7836a571e5a8e4ee93e8fe7e920a4b62756 100644 (file)
@@ -292,12 +292,11 @@ mcf_param_show(struct cli *cli, char **av, void *priv)
                                q = strchr(p, '\n');
                                if (q == NULL)
                                        q = strchr(p, '\0');
-                               assert(q != NULL);
                                if (q > p + 52) {
                                        q = p + 52;
                                        while (q > p && *q != ' ')
                                                q--;
-                                       assert(q != NULL);
+                                       AN(q);
                                }
                                cli_out(cli, "%20s %.*s\n", "", q - p, p);
                                p = q;
index 69999cd80e87128107ddc34b8a9f6358e39cdfa6..44c6bade08d6aa9d0767103b3529e70a76fb992b 100644 (file)
@@ -83,7 +83,7 @@ mgt_vcc_add(const char *name, char *file)
        struct vclprog *vp;
 
        vp = calloc(sizeof *vp, 1);
-       assert(vp != NULL);
+       XXXAN(vp);
        vp->name = strdup(name);
        vp->fname = file;
        TAILQ_INSERT_TAIL(&vclhead, vp, list);
@@ -95,7 +95,7 @@ mgt_vcc_del(struct vclprog *vp)
 {
        TAILQ_REMOVE(&vclhead, vp, list);
        printf("unlink %s\n", vp->fname);
-       AZ(unlink(vp->fname));  /* XXX assert for now */
+       XXXAZ(unlink(vp->fname));
        free(vp->fname);
        free(vp->name);
        free(vp);
@@ -126,7 +126,7 @@ mgt_vcc_default(const char *b_arg, const char *f_arg)
        struct vclprog *vp;
 
        sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-       assert(sb != NULL);
+       XXXAN(sb);
        if (b_arg != NULL) {
                /*
                 * XXX: should do a "HEAD /" on the -b argument to see that
@@ -149,7 +149,7 @@ mgt_vcc_default(const char *b_arg, const char *f_arg)
                    "}\n", addr, port ? port : "http");
                free(addr);
                free(port);
-               assert(buf != NULL);
+               AN(buf);
                vf = VCC_Compile(sb, buf, NULL);
                free(buf);
        } else {
@@ -231,7 +231,7 @@ mcf_config_inline(struct cli *cli, char **av, void *priv)
        (void)priv;
 
        sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-       assert(sb != NULL);
+       XXXAN(sb);
        vf = VCC_Compile(sb, av[3], NULL);
        vsb_finish(sb);
        if (vsb_len(sb) > 0) {
@@ -262,7 +262,7 @@ mcf_config_load(struct cli *cli, char **av, void *priv)
        (void)priv;
 
        sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
-       assert(sb != NULL);
+       XXXAN(sb);
        vf = VCC_CompileFile(sb, av[3]);
        vsb_finish(sb);
        if (vsb_len(sb) > 0) {
index be69874c79ee3cccb30dc9b97cb6a5f94c9edeba..2f1fe650e89894d6099e7ef45c68256d7e7e9744 100644 (file)
@@ -52,7 +52,6 @@ VSLR(enum shmlogtag tag, unsigned id, const char *b, const char *e)
        assert(b != NULL);
        if (e == NULL)
                e = strchr(b, '\0');
-       assert(e != NULL);
 
        /* Truncate */
        l = e - b;
@@ -185,7 +184,7 @@ vsl_buildnew(const char *fn, unsigned size)
        slh.ptr = 0;
        slh.start = sizeof slh + sizeof *params;
        i = write(heritage.vsl_fd, &slh, sizeof slh);
-       assert(i == sizeof slh);
+       xxxassert(i == sizeof slh);
        heritage.vsl_size = slh.start + size;
        AZ(ftruncate(heritage.vsl_fd, (off_t)heritage.vsl_size));
 }
@@ -210,7 +209,7 @@ VSL_MgtInit(const char *fn, unsigned size)
            PROT_READ|PROT_WRITE,
            MAP_HASSEMAPHORE | MAP_NOSYNC | MAP_SHARED,
            heritage.vsl_fd, 0);
-       assert(loghead != MAP_FAILED);
+       xxxassert(loghead != MAP_FAILED);
        VSL_stats = &loghead->stats;
        pp = (void *)(loghead + 1);
        memcpy(pp, params, sizeof *pp);
index 0db5ced8af7cb883d7f57ea94f18f1e647f43380..0ae215cec245b034162a1c60a4eaa844036ccad2 100644 (file)
@@ -92,7 +92,7 @@ smf_calcsize(struct smf_sc *sc, const char *size, int newfile)
        if (bs < fsst.f_bsize)
                bs = fsst.f_bsize;
 
-       assert(S_ISREG(st.st_mode));
+       xxxassert(S_ISREG(st.st_mode));
 
        i = sscanf(size, "%ju%1s", &l, suff); /* can return -1, 0, 1 or 2 */
 
@@ -202,7 +202,7 @@ smf_init(struct stevedore *parent, const char *spec)
        struct smf_sc *sc;
 
        sc = calloc(sizeof *sc, 1);
-       assert(sc != NULL);
+       XXXAN(sc);
        TAILQ_INIT(&sc->order);
        TAILQ_INIT(&sc->free);
        TAILQ_INIT(&sc->used);
@@ -218,9 +218,9 @@ smf_init(struct stevedore *parent, const char *spec)
                asprintf(&p, "%s,", spec);
        else
                p = strdup(spec);
-       assert(p != NULL);
+       XXXAN(p);
        size = strchr(p, ',');
-       assert(size != NULL);
+       XXXAN(size);
 
        *size++ = '\0';
 
@@ -269,7 +269,7 @@ smf_init(struct stevedore *parent, const char *spec)
        }
 
        asprintf(&q, "%s/varnish.XXXXXX", p);
-       assert(q != NULL);
+       XXXAN(q);
        sc->fd = mkstemp(q);
        if (sc->fd < 0) {
                fprintf(stderr,
@@ -279,7 +279,7 @@ smf_init(struct stevedore *parent, const char *spec)
        }
        AZ(unlink(q));
        asprintf(&sc->filename, "%s (unlinked)", q);
-       assert(sc->filename != NULL);
+       XXXAN(sc->filename);
        free(q);
        smf_initfile(sc, size, 1);
 }
@@ -310,7 +310,7 @@ alloc_smf(struct smf_sc *sc, size_t bytes)
 
        /* Split from front */
        sp2 = malloc(sizeof *sp2);
-       assert(sp2 != NULL);
+       XXXAN(sp2);
        VSL_stats->n_smf++;
        *sp2 = *sp;
 
@@ -390,7 +390,7 @@ trim_smf(struct smf *sp, size_t bytes)
        assert(bytes > 0);
        CHECK_OBJ_NOTNULL(sp, SMF_MAGIC);
        sp2 = malloc(sizeof *sp2);
-       assert(sp2 != NULL);
+       XXXAN(sp2);
        VSL_stats->n_smf++;
        *sp2 = *sp;
 
@@ -413,7 +413,7 @@ new_smf(struct smf_sc *sc, unsigned char *ptr, off_t off, size_t len)
        struct smf *sp, *sp2;
 
        sp = calloc(sizeof *sp, 1);
-       assert(sp != NULL);
+       XXXAN(sp);
        sp->magic = SMF_MAGIC;
        sp->s.magic = STORAGE_MAGIC;
        VSL_stats->n_smf++;
@@ -515,7 +515,7 @@ smf_alloc(struct stevedore *st, size_t size)
        smf = alloc_smf(sc, size);
        CHECK_OBJ_NOTNULL(smf, SMF_MAGIC);
        UNLOCK(&sc->mtx);
-       assert(smf != NULL);
+       XXXAN(smf);
        assert(smf->size == size);
        smf->s.space = size;
        smf->s.priv = smf;
@@ -542,7 +542,7 @@ smf_trim(struct storage *s, size_t size)
                return;
        }
        assert(size <= s->space);
-       assert(size > 0);       /* XXX: seen */
+       xxxassert(size > 0);    /* XXX: seen */
        CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC);
        assert(size <= smf->size);
        sc = smf->sc;
index e97a597722a7587c1eafae85492f1f3c26acf7af..1d18d6fa55fb3fcafe28ee9b2852dc8d84f4475c 100644 (file)
@@ -18,10 +18,10 @@ sma_alloc(struct stevedore *st, size_t size)
        struct sma *sma;
 
        sma = calloc(sizeof *sma, 1);
-       assert(sma != NULL);
+       XXXAN(sma);
        sma->s.priv = sma;
        sma->s.ptr = malloc(size);
-       assert(sma->s.ptr != NULL);
+       XXXAN(sma->s.ptr);
        sma->s.len = 0;
        sma->s.space = size;
        sma->s.fd = -1;
index 9183a28435c39273ad11402cd3d6bf551125acb7..79d422a1127266ac43314e36381cae9caf0c9829 100644 (file)
@@ -57,8 +57,8 @@ setup_hash(const char *s_arg)
                q = p = strchr(s_arg, '\0');
        else
                q = p + 1;
-       assert(p != NULL);
-       assert(q != NULL);
+       xxxassert(p != NULL);
+       xxxassert(q != NULL);
        if (!cmp_hash(&hcl_slinger, s_arg, p)) {
                hp = &hcl_slinger;
        } else if (!cmp_hash(&hsl_slinger, s_arg, p)) {
@@ -102,8 +102,8 @@ setup_storage(const char *s_arg)
                q = p = strchr(s_arg, '\0');
        else
                q = p + 1;
-       assert(p != NULL);
-       assert(q != NULL);
+       xxxassert(p != NULL);
+       xxxassert(q != NULL);
        if (!cmp_storage(&sma_stevedore, s_arg, p)) {
                stp = &sma_stevedore;
        } else if (!cmp_storage(&smf_stevedore, s_arg, p)) {
@@ -267,12 +267,12 @@ DebugStunt(void)
        i = read(pipes[1][0], buf, sizeof buf - 1);
        buf[i] = '\0';
        d_child = strtoul(buf, &p, 0);
-       assert(p != NULL);
+       xxxassert(p != NULL);
        printf("New Pid %d\n", d_child);
-       assert(d_child != 0);
+       xxxassert(d_child != 0);
        i = strlen(p);
        j = write(pipes[1][1], p, i);
-       assert(j == i);
+       xxxassert(j == i);
 
        while (1) {
                if (pfd[0].fd == -1 && pfd[1].fd == -1)