r3548 - in trunk/varnish-cache/lib: libvarnish libvcl
phk at projects.linpro.no
phk at projects.linpro.no
Wed Jan 28 11:46:55 CET 2009
Author: phk
Date: 2009-01-28 11:46:54 +0100 (Wed, 28 Jan 2009)
New Revision: 3548
Modified:
trunk/varnish-cache/lib/libvarnish/tcp.c
trunk/varnish-cache/lib/libvarnish/vss.c
trunk/varnish-cache/lib/libvcl/vcc_acl.c
Log:
silence a couple of Flexelint complaints.
Modified: trunk/varnish-cache/lib/libvarnish/tcp.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/tcp.c 2009-01-27 21:14:35 UTC (rev 3547)
+++ trunk/varnish-cache/lib/libvarnish/tcp.c 2009-01-28 10:46:54 UTC (rev 3548)
@@ -216,8 +216,8 @@
TCP_set_read_timeout(int s, double seconds)
{
struct timeval timeout;
- timeout.tv_sec = floor(seconds);
- timeout.tv_usec = 1e6 * (seconds - timeout.tv_sec);
+ timeout.tv_sec = (int)floor(seconds);
+ timeout.tv_usec = (int)(1e6 * (seconds - timeout.tv_sec));
#ifdef SO_RCVTIMEO_WORKS
AZ(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout));
#endif
Modified: trunk/varnish-cache/lib/libvarnish/vss.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vss.c 2009-01-27 21:14:35 UTC (rev 3547)
+++ trunk/varnish-cache/lib/libvarnish/vss.c 2009-01-28 10:46:54 UTC (rev 3548)
@@ -155,7 +155,7 @@
XXXAN(va);
*vap = va;
for (res = res0, i = 0; res != NULL; res = res->ai_next, ++i) {
- va[i] = calloc(1, sizeof(*va[i]));
+ va[i] = calloc(1, sizeof(**va));
XXXAN(va[i]);
va[i]->va_family = res->ai_family;
va[i]->va_socktype = res->ai_socktype;
Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2009-01-27 21:14:35 UTC (rev 3547)
+++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2009-01-28 10:46:54 UTC (rev 3548)
@@ -321,20 +321,20 @@
* Emit a function to match the ACL we have collected
*/
+/*
+ * XXX: this is semi-silly. We try really hard to not depend in the
+ * XXX: systems include files while compiling VCL, but we need to know
+ * XXX: the size of the sa_familiy member.
+ * XXX: FlexeLint complains about these antics, so isolate it in a
+ * XXX: separate function.
+ */
+
+/*lint -save -e506 -e774 -e550 */
static void
-vcc_acl_emit(const struct tokenlist *tl, const char *acln, int anon)
+c_is_a_silly_language(const struct tokenlist *tl)
{
- struct acl_e *ae;
- int depth, l, m, i;
- unsigned at[VRT_ACL_MAXADDR + 1];
- const char *oc;
struct sockaddr sa;
- Fh(tl, 0, "\nstatic int\n");
- Fh(tl, 0, "match_acl_%s_%s(const struct sess *sp, const void *p)\n",
- anon ? "anon" : "named", acln);
- Fh(tl, 0, "{\n");
- Fh(tl, 0, "\tconst unsigned char *a;\n");
assert(sizeof (unsigned char) == 1);
assert(sizeof (unsigned short) == 2);
assert(sizeof (unsigned int) == 4);
@@ -346,7 +346,24 @@
Fh(tl, 0, "\tunsigned int fam;\n");
else
assert(0 == __LINE__);
+}
+/*lint -restore */
+static void
+vcc_acl_emit(const struct tokenlist *tl, const char *acln, int anon)
+{
+ struct acl_e *ae;
+ int depth, l, m, i;
+ unsigned at[VRT_ACL_MAXADDR + 1];
+ const char *oc;
+
+ Fh(tl, 0, "\nstatic int\n");
+ Fh(tl, 0, "match_acl_%s_%s(const struct sess *sp, const void *p)\n",
+ anon ? "anon" : "named", acln);
+ Fh(tl, 0, "{\n");
+ Fh(tl, 0, "\tconst unsigned char *a;\n");
+ c_is_a_silly_language(tl);
+
Fh(tl, 0, "\n");
Fh(tl, 0, "\ta = p;\n");
Fh(tl, 0, "\tVRT_memmove(&fam, a + %d, sizeof fam);\n",
More information about the varnish-commit
mailing list