r5401 - in trunk/varnish-cache: bin/varnishd include lib/libvarnish lib/libvcl lib/libvmod_std
phk at varnish-cache.org
phk at varnish-cache.org
Tue Oct 5 11:00:23 CEST 2010
Author: phk
Date: 2010-10-05 11:00:23 +0200 (Tue, 05 Oct 2010)
New Revision: 5401
Modified:
trunk/varnish-cache/bin/varnishd/Makefile.am
trunk/varnish-cache/bin/varnishd/cache_fetch.c
trunk/varnish-cache/bin/varnishd/cache_lck.c
trunk/varnish-cache/bin/varnishd/cache_vrt_vmod.c
trunk/varnish-cache/bin/varnishd/cache_waiter_ports.c
trunk/varnish-cache/bin/varnishd/hash_critbit.c
trunk/varnish-cache/include/vrt.h
trunk/varnish-cache/lib/libvarnish/Makefile.am
trunk/varnish-cache/lib/libvarnish/binary_heap.c
trunk/varnish-cache/lib/libvcl/vcc_action.c
trunk/varnish-cache/lib/libvcl/vcc_expr.c
trunk/varnish-cache/lib/libvcl/vcc_token.c
trunk/varnish-cache/lib/libvcl/vcc_vmod.c
trunk/varnish-cache/lib/libvmod_std/vmod.py
trunk/varnish-cache/lib/libvmod_std/vmod.vcc
trunk/varnish-cache/lib/libvmod_std/vmod_std.c
Log:
Nitpicking whitespace, licenses and warnings about generated files.
Modified: trunk/varnish-cache/bin/varnishd/Makefile.am
===================================================================
--- trunk/varnish-cache/bin/varnishd/Makefile.am 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/bin/varnishd/Makefile.am 2010-10-05 09:00:23 UTC (rev 5401)
@@ -104,7 +104,16 @@
# Turn the default.vcl file into a C-string we can include in the program.
#
default_vcl.h: default.vcl Makefile
- sed -e 's/"/\\"/g' -e 's/$$/\\n"/' -e 's/^/ "/' $(srcdir)/default.vcl > $@
+ echo '/*' > $@
+ echo ' * NB: This file is machine generated, DO NOT EDIT!' >> $@
+ echo ' *' >> $@
+ echo ' * Edit default.vcl instead and run make' >> $@
+ echo ' *' >> $@
+ echo ' */' >> $@
+ echo '' >> $@
+ sed -e 's/"/\\"/g' \
+ -e 's/$$/\\n"/' \
+ -e 's/^/ "/' $(srcdir)/default.vcl >> $@
# Explicitly record dependency
mgt_vcc.c: default_vcl.h
Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -275,7 +275,7 @@
if (st->len == 0) {
VTAILQ_REMOVE(&sp->obj->store, st, list);
STV_free(st);
- } else
+ } else
STV_trim(st, st->len);
return (1);
Modified: trunk/varnish-cache/bin/varnishd/cache_lck.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_lck.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/bin/varnishd/cache_lck.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -204,8 +204,8 @@
{
AZ(pthread_mutex_init(&lck_mtx, NULL));
-#define LOCK(nam) \
- lck_##nam = VSM_Alloc(sizeof(struct vsc_lck), \
+#define LOCK(nam) \
+ lck_##nam = VSM_Alloc(sizeof(struct vsc_lck), \
VSC_CLASS, VSC_TYPE_LCK, #nam);
#include "locks.h"
#undef LOCK
Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_vmod.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_vmod.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_vmod.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -54,9 +54,9 @@
int ref;
- char *nm;
- char *path;
- void *hdl;
+ char *nm;
+ char *path;
+ void *hdl;
const void *funcs;
int funclen;
};
Modified: trunk/varnish-cache/bin/varnishd/cache_waiter_ports.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_waiter_ports.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/bin/varnishd/cache_waiter_ports.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -86,7 +86,7 @@
assert(sp->fd >= 0);
if(ev->portev_events & POLLERR) {
vca_del(sp->fd);
- VTAILQ_REMOVE(&sesshead, sp, list);
+ VTAILQ_REMOVE(&sesshead, sp, list);
vca_close_session(sp, "EOF");
SES_Delete(sp);
return;
@@ -99,7 +99,7 @@
return;
}
- /*
+ /*
* note: the original man page for port_associate(3C) states:
*
* When an event for a PORT_SOURCE_FD object is retrieved,
@@ -146,7 +146,7 @@
*/
static struct timespec min_ts = {0L, 100L /*ms*/ * 1000L /*us*/ * 1000L /*ns*/};
static double min_t = 0.1; /* 100 ms*/
- static struct timespec max_ts = {1L, 0L}; /* 1 second */
+ static struct timespec max_ts = {1L, 0L}; /* 1 second */
static double max_t = 1.0; /* 1 second */
struct timespec ts;
Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -470,7 +470,7 @@
u = oh->refcnt;
if (u > 0)
oh->refcnt++;
- else
+ else
with_lock = 1;
Lck_Unlock(&oh->mtx);
if (u > 0)
Modified: trunk/varnish-cache/include/vrt.h
===================================================================
--- trunk/varnish-cache/include/vrt.h 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/include/vrt.h 2010-10-05 09:00:23 UTC (rev 5401)
@@ -199,7 +199,7 @@
typedef int vmod_init_f(struct vmod_priv *, const struct VCL_conf *);
-static inline void
+static inline void
vmod_priv_fini(const struct vmod_priv *p)
{
Modified: trunk/varnish-cache/lib/libvarnish/Makefile.am
===================================================================
--- trunk/varnish-cache/lib/libvarnish/Makefile.am 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvarnish/Makefile.am 2010-10-05 09:00:23 UTC (rev 5401)
@@ -42,6 +42,13 @@
[ "$$V" = "exported" ] && [ -e svn_version.c ] && exit 0 ; \
if [ "/* $$V */" != "$$H" ]; then \
( \
+ echo '/*' ;\
+ echo ' * NB: This file is machine generated, DO NOT EDIT!' ;\
+ echo ' *' ;\
+ echo ' * Run make to regenerate' ;\
+ echo ' *' ;\
+ echo ' */' ;\
+ echo '' ;\
echo "/* $$V */" ;\
echo "#include <libvarnish.h>" ;\
echo "const char* svn_version(void)" ;\
Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -303,7 +303,7 @@
assert(!bh->cmp(bh->priv, A(bh, u), A(bh, v)));
}
}
-#endif
+#endif
void *
binheap_root(const struct binheap *bh)
Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -101,8 +101,8 @@
{ INT, T_DECR, INT },
{ INT, T_MUL, INT },
{ INT, T_DIV, INT },
- { INT, '=', INT },
- { INT, 0, INT },
+ { INT, '=', INT },
+ { INT, 0, INT },
{ TIME, T_INCR, DURATION },
{ TIME, T_DECR, DURATION },
{ TIME, T_MUL, REAL },
@@ -115,7 +115,7 @@
{ DURATION, T_DIV, REAL },
{ DURATION, '=', DURATION },
{ DURATION, 0, DURATION },
- { VOID, '=', VOID }
+ { VOID, '=', VOID }
};
static void
@@ -138,7 +138,7 @@
continue;
if (ap->oper != tl->t->tok)
continue;
- if (ap->oper != '=')
+ if (ap->oper != '=')
Fb(tl, 0, "%s %c ", vp->rname, *tl->t->b);
vcc_NextToken(tl);
fmt = ap->want;
Modified: trunk/varnish-cache/lib/libvcl/vcc_expr.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_expr.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvcl/vcc_expr.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * XXX: add VRT_count()'s
+ * XXX: add VRT_count()'s
*/
#include "config.h"
@@ -257,7 +257,7 @@
e = vcc_new_expr();
while (*p != '\0') {
if (*p == '\n') {
- if (!nl)
+ if (!nl)
vsb_putc(e->vsb, *p);
nl = 1;
p++;
@@ -268,14 +268,14 @@
vsb_putc(e->vsb, *p);
p++;
continue;
- }
+ }
assert(*p == '\v');
p++;
switch(*p) {
case '+': vsb_cat(e->vsb, "\v+"); break;
case '-': vsb_cat(e->vsb, "\v-"); break;
- case '1':
- case '2':
+ case '1':
+ case '2':
if (*p == '1')
vsb_cat(e->vsb, vsb_data(e1->vsb));
else {
@@ -478,7 +478,7 @@
"\v+\n\v1,\nvrt_magic_string_end\v-",
e1, NULL);
}
- if (*p != '\0')
+ if (*p != '\0')
SkipToken(tl, ',');
}
*e = vcc_expr_edit((*e)->fmt, q, *e, e1);
@@ -650,7 +650,7 @@
case INT: f2 = INT; break;
case DURATION: f2 = REAL; break;
default:
- if (tl->t->tok != '*' && tl->t->tok != '/')
+ if (tl->t->tok != '*' && tl->t->tok != '/')
return;
vsb_printf(tl->sb, "Operator %.*s not possible on type %s.\n",
PF(tl->t), vcc_Type(f2));
@@ -719,7 +719,7 @@
case TIME: break;
case DURATION: break;
default:
- if (tl->t->tok != '+' && tl->t->tok != '-')
+ if (tl->t->tok != '+' && tl->t->tok != '-')
return;
vsb_printf(tl->sb, "Operator %.*s not possible on type %s.\n",
PF(tl->t), vcc_Type(f2));
@@ -755,7 +755,7 @@
* SYNTAX:
* ExprCmp:
* ExprAdd
- * ExprAdd Relation ExprAdd
+ * ExprAdd Relation ExprAdd
* ExprAdd(STRING) '~' CString
* ExprAdd(STRING) '!~' CString
* ExprAdd(IP) '~' IP
@@ -763,7 +763,7 @@
*/
static const struct cmps {
- enum var_type fmt;
+ enum var_type fmt;
unsigned token;
const char *emit;
} vcc_cmps[] = {
@@ -802,7 +802,7 @@
vcc_expr_add(tl, e, fmt);
ERRCHK(tl);
- if ((*e)->fmt == BOOL)
+ if ((*e)->fmt == BOOL)
return;
tk = tl->t;
@@ -823,7 +823,7 @@
*e = vcc_expr_edit(BOOL, cp->emit, *e, e2);
return;
}
- if ((*e)->fmt == STRING &&
+ if ((*e)->fmt == STRING &&
(tl->t->tok == '~' || tl->t->tok == T_NOMATCH)) {
not = tl->t->tok == '~' ? "" : "!";
vcc_NextToken(tl);
@@ -835,7 +835,7 @@
*e = vcc_expr_edit(BOOL, buf, *e, NULL);
return;
}
- if ((*e)->fmt == IP &&
+ if ((*e)->fmt == IP &&
(tl->t->tok == '~' || tl->t->tok == T_NOMATCH)) {
not = tl->t->tok == '~' ? "" : "!";
vcc_NextToken(tl);
@@ -851,7 +851,7 @@
*e = vcc_expr_edit(BOOL, buf, *e, NULL);
return;
}
- if ((*e)->fmt == BACKEND &&
+ if ((*e)->fmt == BACKEND &&
(tl->t->tok == T_EQ || tl->t->tok == T_NEQ)) {
vcc_NextToken(tl);
ExpectErr(tl, ID);
@@ -894,7 +894,7 @@
{
struct expr *e2;
struct token *tk;
-
+
*e = NULL;
if (fmt != BOOL || tl->t->tok != '!') {
vcc_expr_cmp(tl, e, fmt);
@@ -964,7 +964,7 @@
*e = NULL;
vcc_expr_cand(tl, e, fmt);
ERRCHK(tl);
- if ((*e)->fmt != BOOL || tl->t->tok != T_COR)
+ if ((*e)->fmt != BOOL || tl->t->tok != T_COR)
return;
*e = vcc_expr_edit(BOOL, "(\v+\n\v1", *e, NULL);
while (tl->t->tok == T_COR) {
Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_token.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -171,11 +171,11 @@
x = y = 0;
for (p = l; p < le && *p != '\n'; p++) {
- if (p >= b && p < e)
+ if (p >= b && p < e)
c = '#';
else
c = '-';
-
+
if (*p == '\t') {
y &= ~7;
y += 8;
Modified: trunk/varnish-cache/lib/libvcl/vcc_vmod.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_vmod.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvcl/vcc_vmod.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -71,7 +71,7 @@
return;
}
if (osym != NULL) {
- vsb_printf(tl->sb, "Module %.*s already imported.\n",
+ vsb_printf(tl->sb, "Module %.*s already imported.\n",
PF(mod));
vcc_ErrWhere2(tl, t1, tl->t);
vsb_printf(tl->sb, "Previous import was here:\n");
@@ -110,7 +110,7 @@
hdl = dlopen(fn, RTLD_NOW | RTLD_LOCAL);
if (hdl == NULL) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
+ vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
PF(mod), fn, dlerror());
vcc_ErrWhere(tl, mod);
return;
@@ -118,13 +118,13 @@
modname = dlsym(hdl, "Vmod_Name");
if (modname == NULL) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
+ vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
PF(mod), fn, "Symbol Vmod_Name not found");
vcc_ErrWhere(tl, mod);
return;
}
if (!vcc_IdIs(mod, modname)) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n",
+ vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n",
PF(mod), fn);
vsb_printf(tl->sb, "\tModule has wrong name: <%s>\n", modname);
vcc_ErrWhere(tl, mod);
@@ -133,14 +133,14 @@
proto = dlsym(hdl, "Vmod_Proto");
if (proto == NULL) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
+ vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
PF(mod), fn, "Symbol Vmod_Proto not found");
vcc_ErrWhere(tl, mod);
return;
}
spec = dlsym(hdl, "Vmod_Spec");
if (spec == NULL) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
+ vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
PF(mod), fn, "Symbol Vmod_Spec not found");
vcc_ErrWhere(tl, mod);
return;
Modified: trunk/varnish-cache/lib/libvmod_std/vmod.py
===================================================================
--- trunk/varnish-cache/lib/libvmod_std/vmod.py 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvmod_std/vmod.py 2010-10-05 09:00:23 UTC (rev 5401)
@@ -80,7 +80,7 @@
global plist
global slist
global tdl
- print(fname, rval, args)
+ #print(fname, rval, args)
proto = ctypes[rval] + " vmod_" + fname + "(struct sess *"
sproto = ctypes[rval] + " td_" + modname + "_" + fname + "(struct sess *"
@@ -118,6 +118,9 @@
for l0 in f:
# print("# " + l0)
+ l0=l0.strip()
+ if l0 == "":
+ continue
i = l0.find("#")
if i == 0:
continue
@@ -175,9 +178,25 @@
#######################################################################
+def file_header(fo):
+ fo.write("""/*
+ * $%s$
+ *
+ * NB: This file is machine generated, DO NOT EDIT!
+ *
+ * Edit vmod.vcc and run vmod.py instead
+ */
+
+""" % "Id")
+
+#######################################################################
+
fc = open("vcc_if.c", "w")
fh = open("vcc_if.h", "w")
+file_header(fc)
+file_header(fh)
+
fh.write('struct sess;\n')
fh.write('struct VCL_conf;\n')
fh.write('struct vmod_priv;\n')
@@ -204,7 +223,7 @@
fc.write("const int Vmod_Len = sizeof(Vmod_Func);\n")
fc.write("\n");
-fc.write('const char Vmod_Proto[] = \n')
+fc.write('const char Vmod_Proto[] =\n')
dumps(tdl);
fc.write('\t"\\n"\n')
dumps("struct Vmod_Func_" + modname + " {\n")
Modified: trunk/varnish-cache/lib/libvmod_std/vmod.vcc
===================================================================
--- trunk/varnish-cache/lib/libvmod_std/vmod.vcc 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvmod_std/vmod.vcc 2010-10-05 09:00:23 UTC (rev 5401)
@@ -1,3 +1,30 @@
+#-
+# Copyright (c) 2010 Linpro AS
+# All rights reserved.
+#
+# Author: Poul-Henning Kamp <phk at FreeBSD.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
Module std
Init init_function
Function STRING toupper(PRIV_CALL, STRING_LIST)
Modified: trunk/varnish-cache/lib/libvmod_std/vmod_std.c
===================================================================
--- trunk/varnish-cache/lib/libvmod_std/vmod_std.c 2010-10-05 08:03:38 UTC (rev 5400)
+++ trunk/varnish-cache/lib/libvmod_std/vmod_std.c 2010-10-05 09:00:23 UTC (rev 5401)
@@ -1,3 +1,31 @@
+/*-
+ * Copyright (c) 2010 Linpro AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
More information about the varnish-commit
mailing list