1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Constify some globals.

This commit is contained in:
David Steele 2019-08-08 18:50:54 -04:00
parent e9517dcec0
commit 0e7134d114
6 changed files with 13 additions and 13 deletions

View File

@ -22,7 +22,7 @@ Lock Handler
/***********************************************************************************************************************************
Lock type names
***********************************************************************************************************************************/
static const char *lockTypeName[] =
static const char *const lockTypeName[] =
{
"archive", // lockTypeArchive
"backup", // lockTypeBackup

View File

@ -56,7 +56,7 @@ Convert log level to string and vice versa
***********************************************************************************************************************************/
#define LOG_LEVEL_TOTAL (LOG_LEVEL_MAX + 1)
static const char *logLevelList[LOG_LEVEL_TOTAL] =
static const char *const logLevelList[LOG_LEVEL_TOTAL] =
{
"OFF",
"ASSERT",

View File

@ -95,7 +95,7 @@ By convention all buffer constant identifiers are appended with _BUF.
// Used to declare buffer constants that will be externed using BUFFER_DECLARE(). Must be used in a .c file.
#define BUFFER_STRDEF_EXTERN(name, string) \
const Buffer *name = BUFSTRDEF(string)
const Buffer *const name = BUFSTRDEF(string)
// Used to declare buffer constants that will be local to the .c file. Must be used in a .c file.
#define BUFFER_STRDEF_STATIC(name, string) \
@ -103,7 +103,7 @@ By convention all buffer constant identifiers are appended with _BUF.
// Used to extern buffer constants declared with BUFFER_STRDEF_EXTERN(. Must be used in a .h file.
#define BUFFER_DECLARE(name) \
extern const Buffer *name
extern const Buffer *const name
/***********************************************************************************************************************************
Constant buffers that are generally useful

View File

@ -104,15 +104,15 @@ By convention all string constant identifiers are appended with _STR.
// Used to declare String constants that will be externed using STRING_DECLARE(). Must be used in a .c file.
#define STRING_EXTERN(name, buffer) \
const String *name = STRDEF(buffer)
const String *const name = STRDEF(buffer)
// Used to declare String constants that will be local to the .c file. Must be used in a .c file.
#define STRING_STATIC(name, buffer) \
static const String *name = STRDEF(buffer)
static const String *const name = STRDEF(buffer)
// Used to extern String constants declared with STRING_EXTERN(). Must be used in a .h file.
#define STRING_DECLARE(name) \
extern const String *name
extern const String *const name
/***********************************************************************************************************************************
Constant strings that are generally useful

View File

@ -21,7 +21,7 @@ Constant variants that are generally useful
***********************************************************************************************************************************/
// Used to declare Bool Variant constants that will be externed using VARIANT_DECLARE(). Must be used in a .c file.
#define VARIANT_BOOL_EXTERN(name, dataParam) \
const Variant *name = ((const Variant *)&(const VariantBoolConst){.type = varTypeBool, .data = dataParam})
const Variant *const name = ((const Variant *)&(const VariantBoolConst){.type = varTypeBool, .data = dataParam})
VARIANT_BOOL_EXTERN(BOOL_FALSE_VAR, false);
VARIANT_BOOL_EXTERN(BOOL_TRUE_VAR, true);
@ -100,7 +100,7 @@ typedef struct VariantVariantList
/***********************************************************************************************************************************
Variant type names
***********************************************************************************************************************************/
static const char *variantTypeName[] =
static const char *const variantTypeName[] =
{
"bool", // varTypeBool
"double", // varTypeDouble,
@ -349,7 +349,7 @@ varBoolForce(const Variant *this)
case varTypeString:
{
// List of false/true boolean string values. Note that false/true values must be equal.
static const char *boolString[] =
static const char *const boolString[] =
{
"n", "f", "0", "no", "false", "off",
"y", "t", "1", "yes", "true", "on",

View File

@ -201,11 +201,11 @@ By convention all variant constant identifiers are appended with _VAR.
// Used to declare String Variant constants that will be externed using VARIANT_DECLARE(). Must be used in a .c file.
#define VARIANT_STRDEF_EXTERN(name, dataParam) \
const Variant *name = VARSTRDEF(dataParam)
const Variant *const name = VARSTRDEF(dataParam)
// Used to declare String Variant constants that will be local to the .c file. Must be used in a .c file.
#define VARIANT_STRDEF_STATIC(name, dataParam) \
static const Variant *name = VARSTRDEF(dataParam)
static const Variant *const name = VARSTRDEF(dataParam)
// Create a UInt Variant constant inline from an unsigned int
#define VARUINT(dataParam) \
@ -217,7 +217,7 @@ By convention all variant constant identifiers are appended with _VAR.
// Used to extern String Variant constants declared with VARIANT_STRDEF_EXTERN/STATIC(). Must be used in a .h file.
#define VARIANT_DECLARE(name) \
extern const Variant *name
extern const Variant *const name
/***********************************************************************************************************************************
Constant variants that are generally useful