Standardize on "east const" (type const * not const type *)

Avoid "WARNING: Move const after static - use 'static const char'"
This commit is contained in:
Rangi
2021-11-17 23:01:58 -05:00
committed by Eldred Habert
parent efccf6c931
commit 3e945679ad
17 changed files with 64 additions and 59 deletions

View File

@@ -78,7 +78,7 @@ static void initNode(struct Charnode *node)
memset(node->next, 0, sizeof(node->next));
}
struct Charmap *charmap_New(const char *name, const char *baseName)
struct Charmap *charmap_New(char const *name, char const *baseName)
{
struct Charmap *base = NULL;
@@ -120,7 +120,7 @@ void charmap_Delete(struct Charmap *charmap)
free(charmap);
}
void charmap_Set(const char *name)
void charmap_Set(char const *name)
{
struct Charmap **charmap = (struct Charmap **)hash_GetNode(charmaps, name);

View File

@@ -46,7 +46,7 @@ int32_t fix_Callback_PI(void)
void fix_Print(int32_t i)
{
uint32_t u = i;
const char *sign = "";
char const *sign = "";
if (i < 0) {
u = -u;

View File

@@ -45,7 +45,7 @@
#ifdef __SANITIZE_ADDRESS__
// There are known, non-trivial to fix leaks. We would still like to have `make develop'
// detect memory corruption, though.
const char *__asan_default_options(void) { return "detect_leaks=0"; }
char const *__asan_default_options(void) { return "detect_leaks=0"; }
#endif
// Old Bison versions (confirmed for 2.3) do not forward-declare `yyparse` in the generated header
@@ -68,7 +68,7 @@ bool verbose;
bool warnings; /* True to enable warnings, false to disable them. */
/* Escapes Make-special chars from a string */
static char *make_escape(const char *str)
static char *make_escape(char const *str)
{
char * const escaped_str = malloc(strlen(str) * 2 + 1);
char *dest = escaped_str;

View File

@@ -72,7 +72,7 @@ static uint32_t str2int2(uint8_t *s, uint32_t length)
return r;
}
static char const *strrstr(char const *s1, char const *s2)
static const char *strrstr(char const *s1, char const *s2)
{
size_t len1 = strlen(s1);
size_t len2 = strlen(s2);

View File

@@ -110,7 +110,7 @@ attr_(warn_unused_result) static bool reserveSpace(uint32_t delta_size)
&& (!currentLoadSection || currentLoadSection->size != UINT32_MAX);
}
struct Section *sect_FindSectionByName(const char *name)
struct Section *sect_FindSectionByName(char const *name)
{
for (struct Section *sect = sectionList; sect; sect = sect->next) {
if (strcmp(name, sect->name) == 0)

View File

@@ -324,7 +324,7 @@ void processWarningFlag(char *flag)
warnx("Unknown warning `%s`", flag);
}
void printDiag(const char *fmt, va_list args, char const *type,
void printDiag(char const *fmt, va_list args, char const *type,
char const *flagfmt, char const *flag)
{
fputs(type, stderr);
@@ -334,7 +334,7 @@ void printDiag(const char *fmt, va_list args, char const *type,
lexer_DumpStringExpansions();
}
void error(const char *fmt, ...)
void error(char const *fmt, ...)
{
va_list args;
@@ -344,7 +344,7 @@ void error(const char *fmt, ...)
nbErrors++;
}
_Noreturn void fatalerror(const char *fmt, ...)
_Noreturn void fatalerror(char const *fmt, ...)
{
va_list args;