const-ify some tables

matches found with

	% grep -R '=[	 ]*{' . | fgrep -v const
This commit is contained in:
Omar Polo 2022-03-19 11:02:42 +00:00
parent 9db5e7051e
commit e5d82d9472
8 changed files with 11 additions and 11 deletions

2
fcgi.c
View File

@ -171,7 +171,7 @@ fcgi_send_param(struct bufferevent *bev, const char *name,
uint32_t namlen, vallen, padlen; uint32_t namlen, vallen, padlen;
uint8_t s[8]; uint8_t s[8];
size_t size; size_t size;
char padding[8] = { 0 }; const char padding[8] = { 0 };
namlen = strlen(name); namlen = strlen(name);
vallen = strlen(value); vallen = strlen(value);

2
gmid.c
View File

@ -29,7 +29,7 @@
static const char *opts = "6c:D:d:fH:hnP:p:Vvx:"; 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'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'}, {"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}, {NULL, 0, NULL, 0},

View File

@ -20,7 +20,7 @@ int
main(void) main(void)
{ {
int rfd; int rfd;
struct landlock_ruleset_attr rsattr = { const struct landlock_ruleset_attr rsattr = {
.handled_access_fs = LANDLOCK_ACCESS_FS_READ_FILE | .handled_access_fs = LANDLOCK_ACCESS_FS_READ_FILE |
LANDLOCK_ACCESS_FS_READ_DIR LANDLOCK_ACCESS_FS_READ_DIR
}; };

2
mime.c
View File

@ -55,7 +55,7 @@ add_mime(struct mime *mime, const char *mt, const char *ext)
void void
load_default_mime(struct mime *mime) load_default_mime(struct mime *mime)
{ {
struct etm *i, m[] = { const struct etm *i, m[] = {
{"application/pdf", "pdf"}, {"application/pdf", "pdf"},
{"image/gif", "gif"}, {"image/gif", "gif"},
{"image/jpeg", "jpg"}, {"image/jpeg", "jpg"},

View File

@ -500,7 +500,7 @@ optsemicolon : ';'
%% %%
static struct keyword { static const struct keyword {
const char *word; const char *word;
int token; int token;
} keywords[] = { } keywords[] = {

View File

@ -22,7 +22,7 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b)) #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_readcb(int, short, void *);
static void proxy_tls_writecb(int, short, void *); static void proxy_tls_writecb(int, short, void *);

View File

@ -23,7 +23,7 @@
struct conf conf; struct conf conf;
struct imsgbuf logibuf, servibuf[PROC_MAX]; struct imsgbuf logibuf, servibuf[PROC_MAX];
struct suite { const struct suite {
const char *src; const char *src;
const char *res; const char *res;
} t[] = { } t[] = {
@ -58,7 +58,7 @@ sandbox_logger_process(void)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
struct suite *i; const struct suite *i;
int failed; int failed;
char buf[64]; /* name len */ char buf[64]; /* name len */
const char *parse_err; const char *parse_err;

View File

@ -246,7 +246,7 @@ sandbox_logger_process(void)
# error "Platform does not support seccomp filter yet" # error "Platform does not support seccomp filter yet"
#endif #endif
static struct sock_filter filter[] = { static const struct sock_filter filter[] = {
/* load the *current* architecture */ /* load the *current* architecture */
BPF_STMT(BPF_LD | BPF_W | BPF_ABS, BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
(offsetof(struct seccomp_data, arch))), (offsetof(struct seccomp_data, arch))),
@ -438,7 +438,7 @@ open_landlock(void)
{ {
int fd; int fd;
struct landlock_ruleset_attr attr = { const struct landlock_ruleset_attr attr = {
.handled_access_fs = LANDLOCK_ACCESS_FS_EXECUTE | .handled_access_fs = LANDLOCK_ACCESS_FS_EXECUTE |
LANDLOCK_ACCESS_FS_READ_FILE | LANDLOCK_ACCESS_FS_READ_FILE |
LANDLOCK_ACCESS_FS_READ_DIR | LANDLOCK_ACCESS_FS_READ_DIR |
@ -556,7 +556,7 @@ logger_landlock(void)
void void
sandbox_server_process(void) sandbox_server_process(void)
{ {
struct sock_fprog prog = { const struct sock_fprog prog = {
.len = (unsigned short) (sizeof(filter) / sizeof(filter[0])), .len = (unsigned short) (sizeof(filter) / sizeof(filter[0])),
.filter = filter, .filter = filter,
}; };