Commit 76947728 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Nitpicking whitespace, licenses and warnings about generated files.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5401 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 0d314640
......@@ -104,7 +104,16 @@ DISTCLEANFILES = default_vcl.h
# 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
......
......@@ -275,7 +275,7 @@ fetch_eof(struct sess *sp, struct http_conn *htc)
if (st->len == 0) {
VTAILQ_REMOVE(&sp->obj->store, st, list);
STV_free(st);
} else
} else
STV_trim(st, st->len);
return (1);
......
......@@ -204,8 +204,8 @@ LCK_Init(void)
{
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
......
......@@ -54,9 +54,9 @@ struct vmod {
int ref;
char *nm;
char *path;
void *hdl;
char *nm;
char *path;
void *hdl;
const void *funcs;
int funclen;
};
......
......@@ -86,7 +86,7 @@ vca_port_ev(port_event_t *ev) {
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 @@ vca_port_ev(port_event_t *ev) {
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 @@ vca_main(void *arg)
*/
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;
......
......@@ -470,7 +470,7 @@ hcb_lookup(const struct sess *sp, struct objhead *noh)
u = oh->refcnt;
if (u > 0)
oh->refcnt++;
else
else
with_lock = 1;
Lck_Unlock(&oh->mtx);
if (u > 0)
......
......@@ -199,7 +199,7 @@ struct vmod_priv {
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)
{
......
......@@ -42,6 +42,13 @@ svn_version.c: FORCE
[ "$$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)" ;\
......
......@@ -303,7 +303,7 @@ chk(const struct binheap *bh)
assert(!bh->cmp(bh->priv, A(bh, u), A(bh, v)));
}
}
#endif
#endif
void *
binheap_root(const struct binheap *bh)
......
......@@ -101,8 +101,8 @@ static const struct arith {
{ 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 @@ static const struct arith {
{ DURATION, T_DIV, REAL },
{ DURATION, '=', DURATION },
{ DURATION, 0, DURATION },
{ VOID, '=', VOID }
{ VOID, '=', VOID }
};
static void
......@@ -138,7 +138,7 @@ parse_set(struct vcc *tl)
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;
......
......@@ -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 @@ vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1, struct expr *e2
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 @@ vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1, struct expr *e2
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 @@ vcc_expr_call(struct vcc *tl, struct expr **e, const struct symbol *sym)
"\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 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
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 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
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 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
* SYNTAX:
* ExprCmp:
* ExprAdd
* ExprAdd Relation ExprAdd
* ExprAdd Relation ExprAdd
* ExprAdd(STRING) '~' CString
* ExprAdd(STRING) '!~' CString
* ExprAdd(IP) '~' IP
......@@ -763,7 +763,7 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
*/
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_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
vcc_expr_add(tl, e, fmt);
ERRCHK(tl);
if ((*e)->fmt == BOOL)
if ((*e)->fmt == BOOL)
return;
tk = tl->t;
......@@ -823,7 +823,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
*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 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
*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 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
*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 @@ vcc_expr_not(struct vcc *tl, struct expr **e, enum var_type fmt)
{
struct expr *e2;
struct token *tk;
*e = NULL;
if (fmt != BOOL || tl->t->tok != '!') {
vcc_expr_cmp(tl, e, fmt);
......@@ -964,7 +964,7 @@ vcc_expr0(struct vcc *tl, struct expr **e, enum var_type fmt)
*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) {
......
......@@ -171,11 +171,11 @@ vcc_markline(const struct vcc *tl, const char *l, const char *le,
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;
......
......@@ -71,7 +71,7 @@ vcc_ParseImport(struct vcc *tl)
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 @@ vcc_ParseImport(struct vcc *tl)
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 @@ vcc_ParseImport(struct vcc *tl)
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 @@ vcc_ParseImport(struct vcc *tl)
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;
......
......@@ -80,7 +80,7 @@ def do_func(fname, rval, args):
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 @@ f = open(specfile, "r")
for l0 in f:
# print("# " + l0)
l0=l0.strip()
if l0 == "":
continue
i = l0.find("#")
if i == 0:
continue
......@@ -175,9 +178,25 @@ if initname != "":
#######################################################################
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("\n");
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")
......
#-
# Copyright (c) 2010 Linpro AS
# All rights reserved.
#
# Author: Poul-Henning Kamp <phk@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)
......
/*-
* Copyright (c) 2010 Linpro AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment