Skip to content

Commit 541667f

Browse files
committed
upstream: mark const string array contents const too, i.e. static
const char *array => static const char * const array from Mike Frysinger OpenBSD-Commit-ID: a664e31ea6a795d7c81153274a5f47b22bdc9bc1
1 parent 8cfa73f commit 541667f

7 files changed

+19
-15
lines changed

auth-rhosts.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: auth-rhosts.c,v 1.53 2020/10/18 11:32:01 djm Exp $ */
1+
/* $OpenBSD: auth-rhosts.c,v 1.54 2022/02/01 23:32:51 djm Exp $ */
22
/*
33
* Author: Tatu Ylonen <[email protected]>
44
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
@@ -191,7 +191,7 @@ auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname,
191191
{
192192
char buf[1024];
193193
struct stat st;
194-
static const char *rhosts_files[] = {".shosts", ".rhosts", NULL};
194+
static const char * const rhosts_files[] = {".shosts", ".rhosts", NULL};
195195
u_int rhosts_file_index;
196196

197197
debug2("auth_rhosts2: clientuser %s hostname %s ipaddr %s",

dns.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: dns.c,v 1.41 2021/07/19 03:13:28 dtucker Exp $ */
1+
/* $OpenBSD: dns.c,v 1.42 2022/02/01 23:32:51 djm Exp $ */
22

33
/*
44
* Copyright (c) 2003 Wesley Griffin. All rights reserved.
@@ -43,7 +43,7 @@
4343
#include "log.h"
4444
#include "digest.h"
4545

46-
static const char *errset_text[] = {
46+
static const char * const errset_text[] = {
4747
"success", /* 0 ERRSET_SUCCESS */
4848
"out of memory", /* 1 ERRSET_NOMEMORY */
4949
"general failure", /* 2 ERRSET_FAIL */

kex.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: kex.c,v 1.171 2022/01/06 21:55:23 djm Exp $ */
1+
/* $OpenBSD: kex.c,v 1.172 2022/02/01 23:32:51 djm Exp $ */
22
/*
33
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
44
*
@@ -66,7 +66,7 @@
6666
static int kex_choose_conf(struct ssh *);
6767
static int kex_input_newkeys(int, u_int32_t, struct ssh *);
6868

69-
static const char *proposal_names[PROPOSAL_MAX] = {
69+
static const char * const proposal_names[PROPOSAL_MAX] = {
7070
"KEX algorithms",
7171
"host key algorithms",
7272
"ciphers ctos",

nchan.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: nchan.c,v 1.73 2021/05/19 01:24:05 djm Exp $ */
1+
/* $OpenBSD: nchan.c,v 1.74 2022/02/01 23:32:51 djm Exp $ */
22
/*
33
* Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved.
44
*
@@ -82,8 +82,12 @@ static void chan_shutdown_write(struct ssh *, Channel *);
8282
static void chan_shutdown_read(struct ssh *, Channel *);
8383
static void chan_shutdown_extended_read(struct ssh *, Channel *);
8484

85-
static const char *ostates[] = { "open", "drain", "wait_ieof", "closed" };
86-
static const char *istates[] = { "open", "drain", "wait_oclose", "closed" };
85+
static const char * const ostates[] = {
86+
"open", "drain", "wait_ieof", "closed",
87+
};
88+
static const char * const istates[] = {
89+
"open", "drain", "wait_oclose", "closed",
90+
};
8791

8892
static void
8993
chan_set_istate(Channel *c, u_int next)

sftp-server.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: sftp-server.c,v 1.138 2022/01/14 03:31:52 djm Exp $ */
1+
/* $OpenBSD: sftp-server.c,v 1.139 2022/02/01 23:32:51 djm Exp $ */
22
/*
33
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
44
*
@@ -520,7 +520,7 @@ send_msg(struct sshbuf *m)
520520
static const char *
521521
status_to_message(u_int32_t status)
522522
{
523-
const char *status_messages[] = {
523+
static const char * const status_messages[] = {
524524
"Success", /* SSH_FX_OK */
525525
"End of file", /* SSH_FX_EOF */
526526
"No such file", /* SSH_FX_NO_SUCH_FILE */

ssh-keygen.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ssh-keygen.c,v 1.447 2022/01/05 21:54:37 djm Exp $ */
1+
/* $OpenBSD: ssh-keygen.c,v 1.448 2022/02/01 23:32:51 djm Exp $ */
22
/*
33
* Author: Tatu Ylonen <[email protected]>
44
* Copyright (c) 1994 Tatu Ylonen <[email protected]>, Espoo, Finland
@@ -2460,7 +2460,7 @@ load_sign_key(const char *keypath, const struct sshkey *pubkey)
24602460
{
24612461
size_t i, slen, plen = strlen(keypath);
24622462
char *privpath = xstrdup(keypath);
2463-
const char *suffixes[] = { "-cert.pub", ".pub", NULL };
2463+
static const char * const suffixes[] = { "-cert.pub", ".pub", NULL };
24642464
struct sshkey *ret = NULL, *privkey = NULL;
24652465
int r;
24662466

sshconnect2.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: sshconnect2.c,v 1.355 2022/01/06 22:06:51 djm Exp $ */
1+
/* $OpenBSD: sshconnect2.c,v 1.356 2022/02/01 23:32:51 djm Exp $ */
22
/*
33
* Copyright (c) 2000 Markus Friedl. All rights reserved.
44
* Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -1318,7 +1318,7 @@ identity_sign(struct identity *id, u_char **sigp, size_t *lenp,
13181318
static int
13191319
id_filename_matches(Identity *id, Identity *private_id)
13201320
{
1321-
const char *suffixes[] = { ".pub", "-cert.pub", NULL };
1321+
static const char * const suffixes[] = { ".pub", "-cert.pub", NULL };
13221322
size_t len = strlen(id->filename), plen = strlen(private_id->filename);
13231323
size_t i, slen;
13241324

0 commit comments

Comments
 (0)