[master] f2d75dc Constify the comparison function prototype
Poul-Henning Kamp
phk at FreeBSD.org
Wed May 27 23:38:32 CEST 2015
commit f2d75dc30238d7b2677b20f3ce60f7ff87f6837f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed May 27 07:23:51 2015 +0000
Constify the comparison function prototype
diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 4db9537..e74b328 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -550,10 +550,10 @@ exp_expire(struct exp_priv *ep, double now)
* object expires, accounting also for graceability, it is killed.
*/
-static int
-object_cmp(void *priv, void *a, void *b)
+static int __match_proto__(binheap_cmp_t)
+object_cmp(void *priv, const void *a, const void *b)
{
- struct objcore *aa, *bb;
+ const struct objcore *aa, *bb;
(void)priv;
CAST_OBJ_NOTNULL(aa, a, OBJCORE_MAGIC);
@@ -561,7 +561,7 @@ object_cmp(void *priv, void *a, void *b)
return (aa->timer_when < bb->timer_when);
}
-static void
+static void __match_proto__(binheap_update_t)
object_update(void *priv, void *p, unsigned u)
{
struct objcore *oc;
diff --git a/include/binary_heap.h b/include/binary_heap.h
index d987104..7cef493 100644
--- a/include/binary_heap.h
+++ b/include/binary_heap.h
@@ -35,7 +35,7 @@
struct binheap;
-typedef int binheap_cmp_t(void *priv, void *a, void *b);
+typedef int binheap_cmp_t(void *priv, const void *a, const void *b);
/*
* Comparison function.
* Should return true if item 'a' should be closer to the root
diff --git a/lib/libvarnish/vev.c b/lib/libvarnish/vev.c
index 6429e4b..0ceaaa9 100644
--- a/lib/libvarnish/vev.c
+++ b/lib/libvarnish/vev.c
@@ -38,6 +38,7 @@
#include <string.h>
#include <time.h>
+#include "vdef.h"
#include "miniobj.h"
#include "vas.h"
@@ -93,7 +94,7 @@ struct vev_base {
/*--------------------------------------------------------------------*/
-static void
+static void __match_proto__(binheap_update_t)
vev_bh_update(void *priv, void *a, unsigned u)
{
struct vev_base *evb;
@@ -104,11 +105,11 @@ vev_bh_update(void *priv, void *a, unsigned u)
e->__binheap_idx = u;
}
-static int
-vev_bh_cmp(void *priv, void *a, void *b)
+static int __match_proto__(binheap_cmp_t)
+vev_bh_cmp(void *priv, const void *a, const void *b)
{
struct vev_base *evb;
- struct vev *ea, *eb;
+ const struct vev *ea, *eb;
CAST_OBJ_NOTNULL(evb, priv, VEV_BASE_MAGIC);
CAST_OBJ_NOTNULL(ea, a, VEV_MAGIC);
More information about the varnish-commit
mailing list