const-ify tables ok thomas_adam millert
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index ec7d4be..3d41e56 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -251,7 +251,7 @@ enum gw_query_actions {
GW_TREE,
};
-static struct gw_query_action gw_query_funcs[] = {
+static const struct gw_query_action gw_query_funcs[] = {
{ GW_BLAME, "blame", gw_blame, "gw_tmpl/blame.tmpl" },
{ GW_BLOB, "blob", NULL, NULL },
{ GW_BRIEFS, "briefs", gw_briefs, "gw_tmpl/briefs.tmpl" },
@@ -2022,7 +2022,7 @@ gw_parse_querystring(struct gw_trans *gw_trans)
{
const struct got_error *error = NULL;
struct kpair *p;
- struct gw_query_action *action = NULL;
+ const struct gw_query_action *action = NULL;
unsigned int i;
if (gw_trans->gw_req->fieldnmap[0]) {
diff --git a/lib/deltify.c b/lib/deltify.c
index 3580b0e..b3bbf0b 100644
--- a/lib/deltify.c
+++ b/lib/deltify.c
@@ -41,7 +41,7 @@
* https://www.usenix.org/conference/atc16/technical-sessions/presentation/xia
*/
-static uint32_t geartab[256] = {
+static const uint32_t geartab[256] = {
0x67ed26b7, 0x32da500c, 0x53d0fee0, 0xce387dc7, 0xcd406d90, 0x2e83a4d4,
0x9fc9a38d, 0xb67259dc, 0xca6b1722, 0x6d2ea08c, 0x235cea2e, 0x3149bb5f,
0x1beda787, 0x2a6b77d5, 0x2f22d9ac, 0x91fc0544, 0xe413acfa, 0x5a30ff7a,
diff --git a/libexec/got-send-pack/got-send-pack.c b/libexec/got-send-pack/got-send-pack.c
index 11c0b2d..e3a4b18 100644
--- a/libexec/got-send-pack/got-send-pack.c
+++ b/libexec/got-send-pack/got-send-pack.c
@@ -339,7 +339,7 @@ send_pack(int fd, struct got_pathlist_head *refs,
{
const struct got_error *err = NULL;
char buf[GOT_PKT_MAX];
- unsigned char zero_id[SHA1_DIGEST_LENGTH] = { 0 };
+ const unsigned char zero_id[SHA1_DIGEST_LENGTH] = { 0 };
char old_hashstr[SHA1_DIGEST_STRING_LENGTH];
char new_hashstr[SHA1_DIGEST_STRING_LENGTH];
struct got_pathlist_head their_refs;
diff --git a/regress/delta/delta_test.c b/regress/delta/delta_test.c
index 984dc73..377ea9c 100644
--- a/regress/delta/delta_test.c
+++ b/regress/delta/delta_test.c
@@ -33,7 +33,7 @@
#define nitems(_a) (sizeof(_a) / sizeof((_a)[0]))
#endif
-struct delta_test {
+const struct delta_test {
const char *base;
size_t base_len;
const char *delta;
@@ -67,7 +67,7 @@ delta_apply(void)
return 1;
for (i = 0; i < nitems(delta_tests); i++) {
- struct delta_test *dt = &delta_tests[i];
+ const struct delta_test *dt = &delta_tests[i];
FILE *base_file;
char buf[1024];
size_t n, result_len;
diff --git a/regress/fetch/fetch_test.c b/regress/fetch/fetch_test.c
index 4afec39..5077275 100644
--- a/regress/fetch/fetch_test.c
+++ b/regress/fetch/fetch_test.c
@@ -62,7 +62,7 @@ static int
fetch_parse_uri(void)
{
const struct got_error *err = NULL;
- struct parse_uri_test {
+ const struct parse_uri_test {
const char *uri;
const char *proto;
const char *host;
diff --git a/regress/path/path_test.c b/regress/path/path_test.c
index cb17e05..76b5b1f 100644
--- a/regress/path/path_test.c
+++ b/regress/path/path_test.c
@@ -49,7 +49,7 @@ test_printf(char *fmt, ...)
static int
path_cmp(void)
{
- struct path_cmp_test {
+ const struct path_cmp_test {
const char *path1;
const char *path2;
int expected;