Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
r37080@cat (orig r1304): phk | 2007-04-01 21:01:38 +0200
Browse files Browse the repository at this point in the history
 Various nitpicking prompted by flexelint
 


git-svn-id: http://www.varnish-cache.org/svn/branches/1.0@1347 d4fa192b-c00b-0410-8231-f00ffab90ce4
  • Loading branch information
dag-erling committed Apr 19, 2007
2 parents a1c0fd1 + 6eeadf3 commit 4b65477
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 68 deletions.
36 changes: 11 additions & 25 deletions lib/libvcl/flint.lnt
Expand Up @@ -12,43 +12,29 @@
-sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
-sem(vcc_new_source, custodial(1))

-ffc // No automatic custody
// -ffc // No automatic custody

-esym(534, vsb_printf) // Ignoring return value of function
-esym(534, vsb_cat) // Ignoring return value of function
-esym(534, vsb_bcat) // Ignoring return value of function
-esym(534, vsb_vprintf) // Ignoring return value of function
-esym(534, memset) // Ignoring return value of function
-e788 // enum constant 'HND_Unclass' not used within defaulted switch
-e716 // while(1) ...
-e786 // String concatenation within initializer
-e732 // Loss of sign (arg. no. 2) (int to unsigned int)


-e763 // Redundant declaration for symbol '...' previously declared


-e737 // Loss of sign in promotion from int to unsigned int
-e715 // Symbol 'arg' (line 43) not referenced
-e818 // Pointer parameter '...' could be declared as pointing to const

-e534 // Ignoring return value of function
-e767 // macro 'LIST_INIT' was defined differently

-e506 // Constant value boolean
-e527 // Unreachable code at token 'return'
-e732 // Loss of sign (arg. no. 2) (int to unsigned int)
-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

-e773 // Expression-like macro 'VCL_FARGS' not parenthesized

-e788 // enum constant 'HND_Unclass' not used within defaulted switch

-e716 // while(1) ...
-e641 // Converting enum 'cli_status_e' to int

-e786 // String concatenation within initializer
2 changes: 1 addition & 1 deletion lib/libvcl/vcc_action.c
Expand Up @@ -29,13 +29,13 @@
* $Id$
*/

#include <assert.h>
#include <stdio.h>

#include "vsb.h"

#include "vcc_priv.h"
#include "vcc_compile.h"
#include "libvarnish.h"


/*--------------------------------------------------------------------*/
Expand Down
3 changes: 1 addition & 2 deletions lib/libvcl/vcc_backend.c
Expand Up @@ -32,7 +32,6 @@
#include <sys/types.h>
#include <sys/socket.h>

#include <assert.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
Expand All @@ -41,7 +40,7 @@

#include "vcc_priv.h"
#include "vcc_compile.h"

#include "libvarnish.h"

static const char *
CheckHostPort(const char *host, const char *port)
Expand Down
32 changes: 16 additions & 16 deletions lib/libvcl/vcc_compile.c
Expand Up @@ -60,7 +60,6 @@
* and all the rest...
*/

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
Expand All @@ -79,6 +78,7 @@
#include "vcc_compile.h"

#include "libvcl.h"
#include "libvarnish.h"

struct method method_tab[] = {
#define VCL_RET_MAC(l,U,b,n)
Expand Down Expand Up @@ -113,7 +113,7 @@ TlAlloc(struct tokenlist *tl, unsigned len)
/*--------------------------------------------------------------------*/

int
IsMethod(struct token *t)
IsMethod(const struct token *t)
{
struct method *m;

Expand All @@ -129,7 +129,7 @@ IsMethod(struct token *t)
*/

void
Fh(struct tokenlist *tl, int indent, const char *fmt, ...)
Fh(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;

Expand All @@ -141,7 +141,7 @@ Fh(struct tokenlist *tl, int indent, const char *fmt, ...)
}

void
Fb(struct tokenlist *tl, int indent, const char *fmt, ...)
Fb(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;

Expand All @@ -154,7 +154,7 @@ Fb(struct tokenlist *tl, int indent, const char *fmt, ...)
}

void
Fc(struct tokenlist *tl, int indent, const char *fmt, ...)
Fc(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;

Expand All @@ -166,7 +166,7 @@ Fc(struct tokenlist *tl, int indent, const char *fmt, ...)
}

void
Fi(struct tokenlist *tl, int indent, const char *fmt, ...)
Fi(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;

Expand All @@ -178,7 +178,7 @@ Fi(struct tokenlist *tl, int indent, const char *fmt, ...)
}

void
Ff(struct tokenlist *tl, int indent, const char *fmt, ...)
Ff(const struct tokenlist *tl, int indent, const char *fmt, ...)
{
va_list ap;

Expand Down Expand Up @@ -225,7 +225,7 @@ EncString(struct vsb *sb, const char *b, const char *e, int mode)
}

void
EncToken(struct vsb *sb, struct token *t)
EncToken(struct vsb *sb, const struct token *t)
{

assert(t->tok == CSTR);
Expand All @@ -235,7 +235,7 @@ EncToken(struct vsb *sb, struct token *t)
/*--------------------------------------------------------------------*/

static struct var *
HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh)
HeaderVar(struct tokenlist *tl, const struct token *t, const struct var *vh)
{
char *p;
struct var *v;
Expand Down Expand Up @@ -266,12 +266,12 @@ HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh)
/*--------------------------------------------------------------------*/

struct var *
FindVar(struct tokenlist *tl, struct token *t, struct var *vl)
FindVar(struct tokenlist *tl, const struct token *t, struct var *vl)
{
struct var *v;

for (v = vl; v->name != NULL; v++) {
if (v->fmt == HEADER && t->e - t->b <= v->len)
if (v->fmt == HEADER && (t->e - t->b) <= v->len)
continue;
if (v->fmt != HEADER && t->e - t->b != v->len)
continue;
Expand All @@ -294,7 +294,7 @@ FindVar(struct tokenlist *tl, struct token *t, struct var *vl)
*/

static void
LocTable(struct tokenlist *tl)
LocTable(const struct tokenlist *tl)
{
struct token *t;
unsigned lin, pos;
Expand Down Expand Up @@ -340,7 +340,7 @@ LocTable(struct tokenlist *tl)
/*--------------------------------------------------------------------*/

static void
EmitInitFunc(struct tokenlist *tl)
EmitInitFunc(const struct tokenlist *tl)
{

Fc(tl, 0, "\nstatic void\nVGC_Init(void)\n{\n\n");
Expand All @@ -351,7 +351,7 @@ EmitInitFunc(struct tokenlist *tl)
}

static void
EmitFiniFunc(struct tokenlist *tl)
EmitFiniFunc(const struct tokenlist *tl)
{

Fc(tl, 0, "\nstatic void\nVGC_Fini(void)\n{\n\n");
Expand All @@ -364,7 +364,7 @@ EmitFiniFunc(struct tokenlist *tl)
/*--------------------------------------------------------------------*/

static void
EmitStruct(struct tokenlist *tl)
EmitStruct(const struct tokenlist *tl)
{
struct source *sp;

Expand Down Expand Up @@ -582,7 +582,7 @@ vcc_DestroyTokenList(struct tokenlist *tl, char *ret)
*/

static char *
vcc_CallCc(char *source, struct vsb *sb)
vcc_CallCc(const char *source, struct vsb *sb)
{
FILE *fo, *fs;
char *of, *sf, buf[BUFSIZ];
Expand Down
24 changes: 12 additions & 12 deletions lib/libvcl/vcc_compile.h
Expand Up @@ -140,14 +140,14 @@ void vcc_ParseBackend(struct tokenlist *tl);

/* vcc_compile.c */
extern struct method method_tab[];
void Fh(struct tokenlist *tl, int indent, const char *fmt, ...);
void Fc(struct tokenlist *tl, int indent, const char *fmt, ...);
void Fb(struct tokenlist *tl, int indent, const char *fmt, ...);
void Fi(struct tokenlist *tl, int indent, const char *fmt, ...);
void Ff(struct tokenlist *tl, int indent, const char *fmt, ...);
void EncToken(struct vsb *sb, struct token *t);
struct var *FindVar(struct tokenlist *tl, struct token *t, struct var *vl);
int IsMethod(struct token *t);
void Fh(const struct tokenlist *tl, int indent, const char *fmt, ...);
void Fc(const struct tokenlist *tl, int indent, const char *fmt, ...);
void Fb(const struct tokenlist *tl, int indent, const char *fmt, ...);
void Fi(const struct tokenlist *tl, int indent, const char *fmt, ...);
void Ff(const struct tokenlist *tl, int indent, const char *fmt, ...);
void EncToken(struct vsb *sb, const struct token *t);
struct var *FindVar(struct tokenlist *tl, const struct token *t, struct var *vl);
int IsMethod(const struct token *t);
void *TlAlloc(struct tokenlist *tl, unsigned len);

/* vcc_obj.c */
Expand All @@ -163,11 +163,11 @@ unsigned vcc_UintVal(struct tokenlist *tl);
double vcc_DoubleVal(struct tokenlist *tl);

/* vcc_token.c */
void vcc_ErrToken(struct tokenlist *tl, struct token *t);
void vcc_ErrWhere(struct tokenlist *tl, struct token *t);
void vcc_ErrToken(const struct tokenlist *tl, const struct token *t);
void vcc_ErrWhere(struct tokenlist *tl, const struct token *t);
void vcc__Expect(struct tokenlist *tl, unsigned tok, int line);
int vcc_Teq(struct token *t1, struct token *t2);
int vcc_IdIs(struct token *t, const char *p);
int vcc_Teq(const struct token *t1, const struct token *t2);
int vcc_IdIs(const struct token *t, const char *p);
void vcc_Lexer(struct tokenlist *tl, struct source *sp);
void vcc_NextToken(struct tokenlist *tl);
void vcc__ErrInternal(struct tokenlist *tl, const char *func, unsigned line);
Expand Down
12 changes: 6 additions & 6 deletions lib/libvcl/vcc_parse.c
Expand Up @@ -29,14 +29,14 @@
* $Id$
*/

#include <assert.h>
#include <stdio.h>
#include <string.h>

#include "vsb.h"

#include "vcc_priv.h"
#include "vcc_compile.h"
#include "libvarnish.h"

#include "vrt.h"

Expand Down Expand Up @@ -221,7 +221,7 @@ vcc_RateVal(struct tokenlist *tl)
/*--------------------------------------------------------------------*/

static void
vcc_re(struct tokenlist *tl, const char *str, struct token *re)
vcc_re(struct tokenlist *tl, const char *str, const struct token *re)
{
char buf[32];

Expand All @@ -244,7 +244,7 @@ vcc_re(struct tokenlist *tl, const char *str, struct token *re)
/*--------------------------------------------------------------------*/

static void
Cond_String(struct var *vp, struct tokenlist *tl)
Cond_String(const struct var *vp, struct tokenlist *tl)
{

switch (tl->t->tok) {
Expand All @@ -271,7 +271,7 @@ Cond_String(struct var *vp, struct tokenlist *tl)
}

static void
Cond_Int(struct var *vp, struct tokenlist *tl)
Cond_Int(const struct var *vp, struct tokenlist *tl)
{

Fb(tl, 1, "%s ", vp->rname);
Expand Down Expand Up @@ -317,14 +317,14 @@ Cond_Int(struct var *vp, struct tokenlist *tl)
}

static void
Cond_Bool(struct var *vp, struct tokenlist *tl)
Cond_Bool(const struct var *vp, const struct tokenlist *tl)
{

Fb(tl, 1, "%s\n", vp->rname);
}

static void
Cond_Backend(struct var *vp, struct tokenlist *tl)
Cond_Backend(const struct var *vp, const struct tokenlist *tl)
{

Fb(tl, 1, "%s\n", vp->rname);
Expand Down
11 changes: 6 additions & 5 deletions lib/libvcl/vcc_token.c
Expand Up @@ -44,7 +44,7 @@
/*--------------------------------------------------------------------*/

void
vcc_ErrToken(struct tokenlist *tl, struct token *t)
vcc_ErrToken(const struct tokenlist *tl, const struct token *t)
{

if (t->tok == EOI)
Expand All @@ -65,7 +65,7 @@ vcc__ErrInternal(struct tokenlist *tl, const char *func, unsigned line)
}

void
vcc_ErrWhere(struct tokenlist *tl, struct token *t)
vcc_ErrWhere(struct tokenlist *tl, const struct token *t)
{
unsigned lin, pos, x, y;
const char *p, *l, *f, *b, *e;
Expand Down Expand Up @@ -132,6 +132,7 @@ vcc_ErrWhere(struct tokenlist *tl, struct token *t)
void
vcc_NextToken(struct tokenlist *tl)
{

tl->t = TAILQ_NEXT(tl->t, list);
if (tl->t == NULL) {
vsb_printf(tl->sb,
Expand All @@ -158,7 +159,7 @@ vcc__Expect(struct tokenlist *tl, unsigned tok, int line)
*/

int
vcc_Teq(struct token *t1, struct token *t2)
vcc_Teq(const struct token *t1, const struct token *t2)
{
if (t1->e - t1->b != t2->e - t2->b)
return (0);
Expand All @@ -170,7 +171,7 @@ vcc_Teq(struct token *t1, struct token *t2)
*/

int
vcc_IdIs(struct token *t, const char *p)
vcc_IdIs(const struct token *t, const char *p)
{
const char *q;

Expand All @@ -187,7 +188,7 @@ vcc_IdIs(struct token *t, const char *p)
* Decode %xx in a string
*/

static int
static int8_t
vcc_xdig(const char c)
{
static const char *xdigit =
Expand Down

0 comments on commit 4b65477

Please sign in to comment.