Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constify various constant arrays. #269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mod_http2/h2.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct h2_stream;
* The magic PRIamble of RFC 7540 that is always sent when starting
* a h2 communication.
*/
extern const char *H2_MAGIC_TOKEN;
extern const char *const H2_MAGIC_TOKEN;

#define H2_ERR_NO_ERROR (0x00)
#define H2_ERR_PROTOCOL_ERROR (0x01)
Expand Down
6 changes: 3 additions & 3 deletions mod_http2/h2_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
#include "h2_protocol.h"
#include "mod_http2.h"

const char *h2_protocol_ids_tls[] = {
const char *const h2_protocol_ids_tls[] = {
"h2", NULL
};

const char *h2_protocol_ids_clear[] = {
const char *const h2_protocol_ids_clear[] = {
"h2c", NULL
};

const char *H2_MAGIC_TOKEN = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
const char *const H2_MAGIC_TOKEN = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";

/*******************************************************************************
* HTTP/2 error stuff
Expand Down
4 changes: 2 additions & 2 deletions mod_http2/h2_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
* List of protocol identifiers that we support in cleartext
* negotiations. NULL terminated.
*/
extern const char *h2_protocol_ids_clear[];
extern const char *const h2_protocol_ids_clear[];

/**
* List of protocol identifiers that we support in TLS encrypted
* negotiations (ALPN). NULL terminated.
*/
extern const char *h2_protocol_ids_tls[];
extern const char *const h2_protocol_ids_tls[];

/**
* Provide a user readable description of the HTTP/2 error code-
Expand Down
2 changes: 1 addition & 1 deletion mod_http2/h2_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ static void on_stream_output(void *ctx, h2_stream *stream)
}


static const char *StateNames[] = {
static const char *const StateNames[] = {
"INIT", /* H2_SESSION_ST_INIT */
"DONE", /* H2_SESSION_ST_DONE */
"IDLE", /* H2_SESSION_ST_IDLE */
Expand Down
6 changes: 3 additions & 3 deletions mod_http2/h2_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static int h2_protocol_propose(conn_rec *c, request_rec *r,
{
int proposed = 0;
int is_tls = ap_ssl_conn_is_ssl(c);
const char **protos = is_tls? h2_protocol_ids_tls : h2_protocol_ids_clear;
const char *const *protos = is_tls? h2_protocol_ids_tls : h2_protocol_ids_clear;

if (!h2_mpm_supported()) {
return DECLINED;
Expand Down Expand Up @@ -155,8 +155,8 @@ static int h2_protocol_switch(conn_rec *c, request_rec *r, server_rec *s,
const char *protocol)
{
int found = 0;
const char **protos = ap_ssl_conn_is_ssl(c)? h2_protocol_ids_tls : h2_protocol_ids_clear;
const char **p = protos;
const char *const *protos = ap_ssl_conn_is_ssl(c)? h2_protocol_ids_tls : h2_protocol_ids_clear;
const char *const *p = protos;

(void)s;
if (!h2_mpm_supported()) {
Expand Down