[experimental-ims] 635bc5f Give libvarnishapi a good flexelinting
Geoff Simmons
geoff at varnish-cache.org
Mon Jan 9 21:52:40 CET 2012
commit 635bc5f3a291bf5717bad4c82499dda0e4fb1bb2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sun Nov 20 21:40:50 2011 +0000
Give libvarnishapi a good flexelinting
diff --git a/bin/varnishtest/flint.lnt b/bin/varnishtest/flint.lnt
index 8f3d880..53ad3dc 100644
--- a/bin/varnishtest/flint.lnt
+++ b/bin/varnishtest/flint.lnt
@@ -1,5 +1,7 @@
-esym(850, av)
+-esym(785, VSL_tags)
+-esym(528, iter_call) // Flexelint bug
-e712 // 14 Info 712 Loss of precision (___) (___ to ___)
-e747 // 16 Info 747 Significant prototype coercion (___) ___ to ___
diff --git a/bin/varnishtest/flint.sh b/bin/varnishtest/flint.sh
index eed1686..3a67bd7 100755
--- a/bin/varnishtest/flint.sh
+++ b/bin/varnishtest/flint.sh
@@ -9,4 +9,5 @@ flexelint \
-I../.. \
../flint.lnt \
flint.lnt \
- *.c
+ *.c \
+ ../../lib/libvarnishapi/*.c
diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h
index ac711ea..3cf16c6 100644
--- a/include/vapi/vsc.h
+++ b/include/vapi/vsc.h
@@ -66,7 +66,7 @@ int VSC_Open(struct VSM_data *vd, int diag);
* args and returns as VSM_Open()
*/
-struct VSC_C_main *VSC_Main(struct VSM_data *vd);
+struct VSC_C_main *VSC_Main(const struct VSM_data *vd);
/*
* return Main stats structure
* returns NULL until child has been started.
@@ -84,7 +84,7 @@ struct VSC_point {
typedef int VSC_iter_f(void *priv, const struct VSC_point *const pt);
-int VSC_Iter(struct VSM_data *vd, VSC_iter_f *func, void *priv);
+int VSC_Iter(const struct VSM_data *vd, VSC_iter_f *func, void *priv);
/*
* Iterate over all statistics counters, calling "func" for
* each counter not suppressed by any "-f" arguments.
diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h
index 50a7dde..48cbe70 100644
--- a/include/vapi/vsm.h
+++ b/include/vapi/vsm.h
@@ -126,8 +126,8 @@ struct VSM_head *VSM_Head(const struct VSM_data *vd);
* Return the head of the VSM.
*/
-void VSM__iter0(struct VSM_data *vd, struct VSM_fantom *vf);
-int VSM__itern(struct VSM_data *vd, struct VSM_fantom *vf);
+void VSM__iter0(const struct VSM_data *vd, struct VSM_fantom *vf);
+int VSM__itern(const struct VSM_data *vd, struct VSM_fantom *vf);
#define VSM_FOREACH_SAFE(vf, vd) \
for(VSM__iter0((vd), (vf)); VSM__itern((vd), (vf));)
@@ -137,7 +137,7 @@ int VSM__itern(struct VSM_data *vd, struct VSM_fantom *vf);
* vd = "struct VSM_data *"
*/
-int VSM_StillValid(struct VSM_data *vd, struct VSM_fantom *vf);
+int VSM_StillValid(const struct VSM_data *vd, struct VSM_fantom *vf);
/*
* Return:
* 0: fantom is invalid now.
@@ -145,8 +145,8 @@ int VSM_StillValid(struct VSM_data *vd, struct VSM_fantom *vf);
* 2: a fantom with same dimensions exist, check class/type/ident
*/
-int VSM_Get(struct VSM_data *vd, struct VSM_fantom *vf, const char *class,
- const char *type, const char *ident);
+int VSM_Get(const struct VSM_data *vd, struct VSM_fantom *vf,
+ const char *class, const char *type, const char *ident);
/*
* Find a chunk, produce fantom for it.
* Returns zero on failure.
@@ -166,7 +166,7 @@ void VSM_Close(struct VSM_data *vd);
*/
/* OBSOLETE: Will disappear from Varnish 4.x */
-void *VSM_Find_Chunk(struct VSM_data *vd, const char *class,
+void *VSM_Find_Chunk(const struct VSM_data *vd, const char *class,
const char *type, const char *ident, unsigned *lenp);
/*
* Find a given chunk in the shared memory.
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index 4fc2233..5791e85 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -222,7 +222,7 @@ VSC_Open(struct VSM_data *vd, int diag)
/*--------------------------------------------------------------------*/
struct VSC_C_main *
-VSC_Main(struct VSM_data *vd)
+VSC_Main(const struct VSM_data *vd)
{
struct VSM_fantom vf;
@@ -316,7 +316,7 @@ iter_call(const struct vsc *vsc, VSC_iter_f *func, void *priv,
#undef VSC_DONE
int
-VSC_Iter(struct VSM_data *vd, VSC_iter_f *func, void *priv)
+VSC_Iter(const struct VSM_data *vd, VSC_iter_f *func, void *priv)
{
struct vsc *vsc;
struct VSM_fantom vf;
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index d896301..3c90381 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -294,7 +294,7 @@ VSL_Dispatch(struct VSM_data *vd, VSL_handler_f *func, void *priv)
s |= VSL_S_CLIENT;
if (VSL_BACKEND(p))
s |= VSL_S_BACKEND;
- if (func(priv, VSL_TAG(p), u, l, s, VSL_DATA(p), bitmap))
+ if (func(priv, (enum VSL_tag_e)VSL_TAG(p), u, l, s, VSL_DATA(p), bitmap))
return (1);
}
}
@@ -326,7 +326,8 @@ VSL_H_Print(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
fprintf(fo, "\"\n");
return (0);
}
- fprintf(fo, "%5u %-12s %c %.*s\n", fd, VSL_tags[tag], type, len, ptr);
+ fprintf(fo, "%5u %-12s %c %.*s\n",
+ fd, VSL_tags[tag], type, (int)len, ptr);
return (0);
}
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 81007d8..c410fde 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -46,7 +46,6 @@
#include "vapi/vsm.h"
#include "vapi/vsm_int.h"
-#include "vbm.h"
#include "vin.h"
#include "vsm_api.h"
@@ -288,7 +287,7 @@ VSM_Head(const struct VSM_data *vd)
/*--------------------------------------------------------------------*/
void
-VSM__iter0(struct VSM_data *vd, struct VSM_fantom *vf)
+VSM__iter0(const struct VSM_data *vd, struct VSM_fantom *vf)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
@@ -296,7 +295,7 @@ VSM__iter0(struct VSM_data *vd, struct VSM_fantom *vf)
}
int
-VSM__itern(struct VSM_data *vd, struct VSM_fantom *vf)
+VSM__itern(const struct VSM_data *vd, struct VSM_fantom *vf)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
@@ -327,7 +326,7 @@ VSM__itern(struct VSM_data *vd, struct VSM_fantom *vf)
/*--------------------------------------------------------------------*/
int
-VSM_StillValid(struct VSM_data *vd, struct VSM_fantom *vf)
+VSM_StillValid(const struct VSM_data *vd, struct VSM_fantom *vf)
{
struct VSM_fantom f2;
@@ -346,8 +345,8 @@ VSM_StillValid(struct VSM_data *vd, struct VSM_fantom *vf)
}
int
-VSM_Get(struct VSM_data *vd, struct VSM_fantom *vf, const char *class,
- const char *type, const char *ident)
+VSM_Get(const struct VSM_data *vd, struct VSM_fantom *vf,
+ const char *class, const char *type, const char *ident)
{
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
@@ -367,8 +366,8 @@ VSM_Get(struct VSM_data *vd, struct VSM_fantom *vf, const char *class,
/*--------------------------------------------------------------------*/
void *
-VSM_Find_Chunk(struct VSM_data *vd, const char *class, const char *type,
- const char *ident, unsigned *lenp)
+VSM_Find_Chunk(const struct VSM_data *vd, const char *class,
+ const char *type, const char *ident, unsigned *lenp)
{
struct VSM_fantom vf;
diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h
index 84ea523..3355ee4 100644
--- a/lib/libvarnishapi/vsm_api.h
+++ b/lib/libvarnishapi/vsm_api.h
@@ -56,8 +56,5 @@ struct VSM_data {
struct vsl *vsl;
};
-struct VSM_chunk *VSM_find_alloc(struct VSM_data *vd, const char *class,
- const char *type, const char *ident);
-
void VSC_Delete(struct VSM_data *vd);
void VSL_Delete(struct VSM_data *vd);
More information about the varnish-commit
mailing list