mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
Improve const char declarations
Declare C string constants using array syntax, avoid pointer syntax when possible. They are different, the array syntax generates smaller, faster code. Also, const char[] should usually be static, again to avoid poor compilation and runtime performance where compilers tend to initialize the const declaration for every call instead of using .rodata for the string. Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include <config.h>
|
||||
#include <auth/common.h>
|
||||
|
||||
const char* pass_msg_second = "Please enter your challenge password.";
|
||||
const char* pass_msg_failed = "Login failed.\nPlease enter your password.";
|
||||
const char* pass_msg_otp = "Please enter your OTP password.";
|
||||
|
||||
const char pass_msg_second[] = "Please enter your challenge password.";
|
||||
const char pass_msg_failed[] = "Login failed.\nPlease enter your password.";
|
||||
const char pass_msg_otp[] = "Please enter your OTP password.";
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#define MAX_PASSWORD_TRIES 3
|
||||
|
||||
extern const char* pass_msg_second;
|
||||
extern const char* pass_msg_otp;
|
||||
extern const char* pass_msg_failed;
|
||||
extern const char pass_msg_second[];
|
||||
extern const char pass_msg_otp[];
|
||||
extern const char pass_msg_failed[];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -89,8 +89,8 @@ void update_fd_limits(main_server_st * s, unsigned main)
|
||||
void set_self_oom_score_adj(main_server_st * s)
|
||||
{
|
||||
#ifdef __linux__
|
||||
const char proc_self_oom_adj_score_path[] = "/proc/self/oom_score_adj";
|
||||
const char oom_adj_score_value[] = "1000";
|
||||
static const char proc_self_oom_adj_score_path[] = "/proc/self/oom_score_adj";
|
||||
static const char oom_adj_score_value[] = "1000";
|
||||
size_t written = 0;
|
||||
int fd;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ typedef enum script_type_t {
|
||||
SCRIPT_DISCONNECT
|
||||
} script_type_t;
|
||||
|
||||
static const char *type_name[] = {"up", "host-update", "down"};
|
||||
static const char * const type_name[] = {"up", "host-update", "down"};
|
||||
|
||||
static void export_fw_info(main_server_st *s, struct proc_st* proc)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user