Commit Diff
Diff:
9db5e7051ebb37a9078e79ca46daf7f8f8f3f963
e5d82d9472513ef742dbb0b5ac451337625feb58
Commit:
e5d82d9472513ef742dbb0b5ac451337625feb58
Tree:
f702b4f52830b6a8c111071b3f7d48213229d2eb
Author:
Omar Polo <op@omarpolo.com>
Date:
Sat Mar 19 11:02:42 2022 UTC
Message:
const-ify some tables

matches found with

% grep -R '=[ ]*{' . | fgrep -v const
commit - 9db5e7051ebb37a9078e79ca46daf7f8f8f3f963
commit + e5d82d9472513ef742dbb0b5ac451337625feb58
blob - 6fbb21b436433f1f6f6b1c13f13e989e9b45550e
blob + 6e67ea75b2b4a453a181194060a43451d743a835
--- fcgi.c
+++ fcgi.c
@@ -171,7 +171,7 @@ fcgi_send_param(struct bufferevent *bev, const char *n
uint32_t namlen, vallen, padlen;
uint8_t s[8];
size_t size;
- char padding[8] = { 0 };
+ const char padding[8] = { 0 };
namlen = strlen(name);
vallen = strlen(value);
blob - b2aa170ec80fee36d5c742ddad81606e572ffb70
blob + 34132bc47b971063da9312c2a24b86a44adf8d21
--- gmid.c
+++ gmid.c
@@ -29,7 +29,7 @@ static struct option longopts[] = {
static const char *opts = "6c:D:d:fH:hnP:p:Vvx:";
-static struct option longopts[] = {
+static const struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0},
blob - 8be29bd370345824936362a9d053dd8ca210696c
blob + 1e788a636fe0b9bb5f0b1a2f47af006f80014954
--- have/landlock.c
+++ have/landlock.c
@@ -20,7 +20,7 @@ main(void)
main(void)
{
int rfd;
- struct landlock_ruleset_attr rsattr = {
+ const struct landlock_ruleset_attr rsattr = {
.handled_access_fs = LANDLOCK_ACCESS_FS_READ_FILE |
LANDLOCK_ACCESS_FS_READ_DIR
};
blob - cd759de682f8a366013f289533f77a15fb426bc7
blob + 398d5614e7328c9281fd1392b678192a18dba4b9
--- mime.c
+++ mime.c
@@ -55,7 +55,7 @@ load_default_mime(struct mime *mime)
void
load_default_mime(struct mime *mime)
{
- struct etm *i, m[] = {
+ const struct etm *i, m[] = {
{"application/pdf", "pdf"},
{"image/gif", "gif"},
{"image/jpeg", "jpg"},
blob - 47fd2c60dfa4090b5f3e89aa5883fd9f4ffa3a34
blob + a71291a8a875864f5ccd8038027c8802b676e636
--- parse.y
+++ parse.y
@@ -500,7 +500,7 @@ static struct keyword {
%%
-static struct keyword {
+static const struct keyword {
const char *word;
int token;
} keywords[] = {
blob - 1a30531dd3cd6492113b4aca40aede35641985a2
blob + c4f0677e017afeb0a02852ea222bf40d7c000347
--- proxy.c
+++ proxy.c
@@ -22,7 +22,7 @@ static struct timeval handshake_timeout = { 5, 0 };
#define MIN(a, b) ((a) < (b) ? (a) : (b))
-static struct timeval handshake_timeout = { 5, 0 };
+static const struct timeval handshake_timeout = { 5, 0 };
static void proxy_tls_readcb(int, short, void *);
static void proxy_tls_writecb(int, short, void *);
blob - b3923350574b8147ce79f90847f7e24bb011c25c
blob + c6757e56846f016357f6585965c3e08415af4ef4
--- regress/puny-test.c
+++ regress/puny-test.c
@@ -23,7 +23,7 @@ struct suite {
struct conf conf;
struct imsgbuf logibuf, servibuf[PROC_MAX];
-struct suite {
+const struct suite {
const char *src;
const char *res;
} t[] = {
@@ -58,7 +58,7 @@ main(int argc, char **argv)
int
main(int argc, char **argv)
{
- struct suite *i;
+ const struct suite *i;
int failed;
char buf[64]; /* name len */
const char *parse_err;
blob - 0ab50d1d64f64481f5190b8589f899c96614579d
blob + d22126081dad10afde8ce6fc233fa7f20a4602ec
--- sandbox.c
+++ sandbox.c
@@ -246,7 +246,7 @@ static struct sock_filter filter[] = {
# error "Platform does not support seccomp filter yet"
#endif
-static struct sock_filter filter[] = {
+static const struct sock_filter filter[] = {
/* load the *current* architecture */
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
(offsetof(struct seccomp_data, arch))),
@@ -438,7 +438,7 @@ open_landlock(void)
{
int fd;
- struct landlock_ruleset_attr attr = {
+ const struct landlock_ruleset_attr attr = {
.handled_access_fs = LANDLOCK_ACCESS_FS_EXECUTE |
LANDLOCK_ACCESS_FS_READ_FILE |
LANDLOCK_ACCESS_FS_READ_DIR |
@@ -556,7 +556,7 @@ sandbox_server_process(void)
void
sandbox_server_process(void)
{
- struct sock_fprog prog = {
+ const struct sock_fprog prog = {
.len = (unsigned short) (sizeof(filter) / sizeof(filter[0])),
.filter = filter,
};
Omar Polo