[master] c6b4d18 Make the records static in the VSLQ_dispatch_f() api
Poul-Henning Kamp
phk at varnish-cache.org
Sat Jun 29 13:12:10 CEST 2013
commit c6b4d18128aa6b79b1e6c3cba9df7c4c127a3d90
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sat Jun 29 11:11:31 2013 +0000
Make the records static in the VSLQ_dispatch_f() api
Use the and mark __match_proto__() the typedef where applicable.
diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c
index fc58cae..d90fa1e 100644
--- a/bin/varnishtest/vtc_logexp.c
+++ b/bin/varnishtest/vtc_logexp.c
@@ -57,7 +57,6 @@
#include "vapi/vsl.h"
#include "vtim.h"
#include "vqueue.h"
-#include "miniobj.h"
#include "vas.h"
#include "vre.h"
@@ -176,8 +175,9 @@ logexp_next(struct logexp *le)
vtc_log(le->vl, 3, "tst| %s", VSB_data(le->test->str));
}
-static int
-logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction *pt[], void *priv)
+static int __match_proto__(VSLQ_dispatch_f)
+logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction * const pt[],
+ void *priv)
{
struct logexp *le;
struct VSL_transaction *t;
@@ -275,7 +275,7 @@ logexp_thread(void *priv)
AZ(le->test);
logexp_next(le);
while (le->test) {
- i = VSLQ_Dispatch(le->vslq, &logexp_dispatch, le);
+ i = VSLQ_Dispatch(le->vslq, logexp_dispatch, le);
if (i < 0)
vtc_log(le->vl, 0, "dispatch: %d", i);
if (i == 0 && le->test)
diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h
index 30507c0..138e920 100644
--- a/include/vapi/vsl.h
+++ b/include/vapi/vsl.h
@@ -84,6 +84,21 @@ enum VSL_grouping_e {
VSL_g_session,
};
+typedef int VSLQ_dispatch_f(struct VSL_data *vsl,
+ struct VSL_transaction * const trans[], void *priv);
+ /*
+ * The callback function type for use with VSLQ_Dispatch.
+ *
+ * Arguments:
+ * vsl: The VSL_data context
+ * trans[]: A NULL terminated array of pointers to VSL_transaction.
+ * priv: The priv argument from VSL_Dispatch
+ *
+ * Return value:
+ * 0: OK - continue
+ * !=0: Makes VSLQ_Dispatch return with this return value immediatly
+ */
+
extern const char *VSL_tags[256];
/*
* Tag to string array. Contains NULL for invalid tags.
@@ -260,8 +275,7 @@ int VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo);
* !=0: Return value from either VSL_Next or VSL_Print
*/
-int VSL_PrintTransactions(struct VSL_data *vsl,
- struct VSL_transaction *ptrans[], void *fo);
+VSLQ_dispatch_f VSL_PrintTransactions;
/*
* Prints out each transaction in the array ptrans. For
* transactions of level > 0 it will print a header before the log
@@ -316,8 +330,7 @@ int VSL_WriteAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo);
* !=0: Return value from either VSL_Next or VSL_Write
*/
-int VSL_WriteTransactions(struct VSL_data *vsl,
- struct VSL_transaction *ptrans[], void *fo);
+VSLQ_dispatch_f VSL_WriteTransactions;
/*
* Write all transactions in ptrans using VSL_WriteAll
* Return values:
@@ -347,21 +360,6 @@ void VSLQ_Delete(struct VSLQ **pvslq);
* Delete the query pointed to by pvslq, freeing up the resources
*/
-typedef int VSLQ_dispatch_f(struct VSL_data *vsl,
- struct VSL_transaction *trans[], void *priv);
- /*
- * The callback function type for use with VSLQ_Dispatch.
- *
- * Arguments:
- * vsl: The VSL_data context
- * trans[]: A NULL terminated array of pointers to VSL_transaction.
- * priv: The priv argument from VSL_Dispatch
- *
- * Return value:
- * 0: OK - continue
- * !=0: Makes VSLQ_Dispatch return with this return value immediatly
- */
-
int VSLQ_Dispatch(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv);
/*
* Process log and call func for each set matching the specified
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index f263862..501e19a 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -307,8 +307,8 @@ VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo)
}
}
-int
-VSL_PrintTransactions(struct VSL_data *vsl, struct VSL_transaction *pt[],
+int __match_proto__(VSLQ_dispatch_f)
+VSL_PrintTransactions(struct VSL_data *vsl, struct VSL_transaction * const pt[],
void *fo)
{
struct VSL_transaction *t;
@@ -425,8 +425,8 @@ VSL_WriteAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo)
}
}
-int
-VSL_WriteTransactions(struct VSL_data *vsl, struct VSL_transaction *pt[],
+int __match_proto__(VSLQ_dispatch_f)
+VSL_WriteTransactions(struct VSL_data *vsl, struct VSL_transaction * const pt[],
void *fo)
{
struct VSL_transaction *t;
diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c
index 443a176..ca1bce7 100644
--- a/lib/libvarnishapi/vsl_cursor.c
+++ b/lib/libvarnishapi/vsl_cursor.c
@@ -270,6 +270,7 @@ VSL_CursorVSM(struct VSL_data *vsl, struct VSM_data *vsm, int tail)
} else
AZ(vslc_vsm_reset(&c->c));
+ /* XXX: How does 'c' ever get freed ? */
return (&c->c.c);
}
More information about the varnish-commit
mailing list