[master] 82c7746 Constification
Poul-Henning Kamp
phk at FreeBSD.org
Fri Nov 29 12:15:37 CET 2013
commit 82c7746437cc6d0f2677e3b28f940e790e84ca0b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Nov 29 11:08:28 2013 +0000
Constification
diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h
index 6d1308b..ace0122 100644
--- a/include/vapi/vsl.h
+++ b/include/vapi/vsl.h
@@ -245,12 +245,12 @@ struct VSL_cursor *VSL_CursorFile(struct VSL_data *vsl, const char *name,
* NULL: Error, see VSL_Error
*/
-void VSL_DeleteCursor(struct VSL_cursor *c);
+void VSL_DeleteCursor(const struct VSL_cursor *c);
/*
* Delete the cursor pointed to by c
*/
-int VSL_ResetCursor(struct VSL_cursor *c);
+int VSL_ResetCursor(const struct VSL_cursor *c);
/*
* Reset the cursor position to the head, so that the next call to
* VSL_Next returns the first record. For VSM cursor, it will
@@ -273,7 +273,7 @@ int VSL_Check(const struct VSL_cursor *c, const struct VSLC_ptr *ptr);
* 2: Valid
*/
-int VSL_Next(struct VSL_cursor *c);
+int VSL_Next(const struct VSL_cursor *c);
/*
* Return raw pointer to next VSL record.
*
@@ -333,7 +333,7 @@ int VSL_PrintTerse(const struct VSL_data *vsl, const struct VSL_cursor *c,
* -5: I/O write error - see errno
*/
-int VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo);
+int VSL_PrintAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
/*
* Calls VSL_Next on c until c is exhausted. In turn calls
* VSL_Print on all records where VSL_Match returns true.
@@ -393,7 +393,7 @@ int VSL_Write(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
* -5: I/O error - see VSL_Error
*/
-int VSL_WriteAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo);
+int VSL_WriteAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
/*
* Calls VSL_Next on c until c is exhausted. In turn calls
* VSL_Write on all records where VSL_Match returns true.
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 8375a2c..dd17839 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -302,7 +302,7 @@ VSL_PrintTerse(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
}
int
-VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo)
+VSL_PrintAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
{
int i;
@@ -436,7 +436,7 @@ VSL_Write(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
}
int
-VSL_WriteAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo)
+VSL_WriteAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo)
{
int i;
diff --git a/lib/libvarnishapi/vsl_api.h b/lib/libvarnishapi/vsl_api.h
index c7996a9..b3199bb 100644
--- a/lib/libvarnishapi/vsl_api.h
+++ b/lib/libvarnishapi/vsl_api.h
@@ -42,9 +42,9 @@ int vsl_diag(struct VSL_data *vsl, const char *fmt, ...)
void vsl_vbm_bitset(int bit, void *priv);
void vsl_vbm_bitclr(int bit, void *priv);
-typedef void vslc_delete_f(struct VSL_cursor *);
-typedef int vslc_next_f(struct VSL_cursor *);
-typedef int vslc_reset_f(struct VSL_cursor *);
+typedef void vslc_delete_f(const struct VSL_cursor *);
+typedef int vslc_next_f(const struct VSL_cursor *);
+typedef int vslc_reset_f(const struct VSL_cursor *);
typedef int vslc_check_f(const struct VSL_cursor *, const struct VSLC_ptr *);
struct vslc_tbl {
diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c
index de545c7..ea9633c 100644
--- a/lib/libvarnishapi/vsl_cursor.c
+++ b/lib/libvarnishapi/vsl_cursor.c
@@ -64,7 +64,7 @@ struct vslc_vsm {
};
static void
-vslc_vsm_delete(struct VSL_cursor *cursor)
+vslc_vsm_delete(const struct VSL_cursor *cursor)
{
struct vslc_vsm *c;
@@ -114,7 +114,7 @@ vslc_vsm_check(const struct VSL_cursor *cursor, const struct VSLC_ptr *ptr)
}
static int
-vslc_vsm_next(struct VSL_cursor *cursor)
+vslc_vsm_next(const struct VSL_cursor *cursor)
{
struct vslc_vsm *c;
int i;
@@ -189,7 +189,7 @@ vslc_vsm_next(struct VSL_cursor *cursor)
}
static int
-vslc_vsm_reset(struct VSL_cursor *cursor)
+vslc_vsm_reset(const struct VSL_cursor *cursor)
{
struct vslc_vsm *c;
unsigned segment;
@@ -290,7 +290,7 @@ struct vslc_file {
};
static void
-vslc_file_delete(struct VSL_cursor *cursor)
+vslc_file_delete(const struct VSL_cursor *cursor)
{
struct vslc_file *c;
@@ -320,7 +320,7 @@ vslc_file_readn(int fd, void *buf, size_t n)
}
static int
-vslc_file_next(struct VSL_cursor *cursor)
+vslc_file_next(const struct VSL_cursor *cursor)
{
struct vslc_file *c;
ssize_t i;
@@ -363,7 +363,7 @@ vslc_file_next(struct VSL_cursor *cursor)
}
static int
-vslc_file_reset(struct VSL_cursor *cursor)
+vslc_file_reset(const struct VSL_cursor *cursor)
{
(void)cursor;
/* XXX: Implement me */
@@ -439,7 +439,7 @@ VSL_CursorFile(struct VSL_data *vsl, const char *name, unsigned options)
}
void
-VSL_DeleteCursor(struct VSL_cursor *cursor)
+VSL_DeleteCursor(const struct VSL_cursor *cursor)
{
const struct vslc_tbl *tbl;
@@ -450,7 +450,7 @@ VSL_DeleteCursor(struct VSL_cursor *cursor)
}
int
-VSL_ResetCursor(struct VSL_cursor *cursor)
+VSL_ResetCursor(const struct VSL_cursor *cursor)
{
const struct vslc_tbl *tbl;
@@ -461,7 +461,7 @@ VSL_ResetCursor(struct VSL_cursor *cursor)
}
int
-VSL_Next(struct VSL_cursor *cursor)
+VSL_Next(const struct VSL_cursor *cursor)
{
const struct vslc_tbl *tbl;
diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c
index ed1d0f4..a9303f2 100644
--- a/lib/libvarnishapi/vsl_dispatch.c
+++ b/lib/libvarnishapi/vsl_dispatch.c
@@ -209,7 +209,7 @@ VRB_PROTOTYPE_STATIC(vtx_tree, vtx_key, entry, vtx_keycmp)
VRB_GENERATE_STATIC(vtx_tree, vtx_key, entry, vtx_keycmp)
static int
-vslc_raw_next(struct VSL_cursor *cursor)
+vslc_raw_next(const struct VSL_cursor *cursor)
{
struct vslc_raw *c;
@@ -227,7 +227,7 @@ vslc_raw_next(struct VSL_cursor *cursor)
}
static int
-vslc_raw_reset(struct VSL_cursor *cursor)
+vslc_raw_reset(const struct VSL_cursor *cursor)
{
struct vslc_raw *c;
@@ -249,7 +249,7 @@ static const struct vslc_tbl vslc_raw_tbl = {
};
static int
-vslc_vtx_next(struct VSL_cursor *cursor)
+vslc_vtx_next(const struct VSL_cursor *cursor)
{
struct vslc_vtx *c;
const uint32_t *ptr;
@@ -300,7 +300,7 @@ vslc_vtx_next(struct VSL_cursor *cursor)
}
static int
-vslc_vtx_reset(struct VSL_cursor *cursor)
+vslc_vtx_reset(const struct VSL_cursor *cursor)
{
struct vslc_vtx *c;
@@ -573,7 +573,7 @@ vtx_retire(struct VSLQ *vslq, struct vtx **pvtx)
/* Lookup a vtx by vxid from the managed list */
static struct vtx *
-vtx_lookup(struct VSLQ *vslq, unsigned vxid)
+vtx_lookup(const struct VSLQ *vslq, unsigned vxid)
{
struct vtx_key lkey, *key;
struct vtx *vtx;
diff --git a/lib/libvarnishapi/vsl_glob_test.c b/lib/libvarnishapi/vsl_glob_test.c
index 6bf0ddd..6aac16a 100644
--- a/lib/libvarnishapi/vsl_glob_test.c
+++ b/lib/libvarnishapi/vsl_glob_test.c
@@ -44,7 +44,7 @@ cb(int tag, void *priv)
}
int
-main(int argc, char *argv[])
+main(int argc, char * const *argv)
{
int i;
diff --git a/lib/libvarnishapi/vxp.c b/lib/libvarnishapi/vxp.c
index 75a7614..b1c8c2f 100644
--- a/lib/libvarnishapi/vxp.c
+++ b/lib/libvarnishapi/vxp.c
@@ -53,7 +53,8 @@ vxp_ErrToken(const struct vxp *vxp, const struct token *t)
}
static void
-vxp_Pos(struct vxp *vxp, struct vsb *vsb, const struct token *t, int tokoff)
+vxp_Pos(const struct vxp *vxp, struct vsb *vsb, const struct token *t,
+ int tokoff)
{
unsigned pos;
@@ -68,7 +69,7 @@ vxp_Pos(struct vxp *vxp, struct vsb *vsb, const struct token *t, int tokoff)
}
static void
-vxp_quote(struct vxp *vxp, const char *b, const char *e, int tokoff)
+vxp_quote(const struct vxp *vxp, const char *b, const char *e, int tokoff)
{
const char *p;
char c;
diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c
index 01f5272..6fc726b 100644
--- a/lib/libvarnishapi/vxp_parse.c
+++ b/lib/libvarnishapi/vxp_parse.c
@@ -50,7 +50,7 @@
static void vxp_expr_or(struct vxp *vxp, struct vex **pvex);
static struct vex *
-vex_alloc(struct vxp *vxp)
+vex_alloc(const struct vxp *vxp)
{
struct vex *vex;
diff --git a/lib/libvarnishapi/vxp_test.c b/lib/libvarnishapi/vxp_test.c
index 1104039..89437f1 100644
--- a/lib/libvarnishapi/vxp_test.c
+++ b/lib/libvarnishapi/vxp_test.c
@@ -17,7 +17,7 @@ usage(void)
}
int
-main(int argc, char **argv)
+main(int argc, char * const *argv)
{
struct vsb *vsb;
struct vex *vex;
More information about the varnish-commit
mailing list