0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00

More constification, mostly of struct dfmt

Make struct dfmt and the struct dfmt arrays const across the board,
and make them static whereever possible.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
H. Peter Anvin
2016-02-18 02:16:36 -08:00
parent f0ea3d7c2b
commit 7e3b12d6da
12 changed files with 44 additions and 37 deletions

View File

@@ -47,9 +47,11 @@
#define BUILD_DRIVERS_ARRAY
#include "output/outform.h"
const struct ofmt *ofmt_find(char *name, const struct ofmt_alias **ofmt_alias)
const struct ofmt *ofmt_find(const char *name,
const struct ofmt_alias **ofmt_alias)
{
const struct ofmt **ofp, *of;
const struct ofmt * const *ofp;
const struct ofmt *of;
unsigned int i;
*ofmt_alias = NULL;
@@ -72,9 +74,10 @@ const struct ofmt *ofmt_find(char *name, const struct ofmt_alias **ofmt_alias)
return NULL;
}
struct dfmt *dfmt_find(const struct ofmt *ofmt, char *name)
const struct dfmt *dfmt_find(const struct ofmt *ofmt, const char *name)
{
struct dfmt **dfp, *df;
const struct dfmt * const *dfp;
const struct dfmt *df;
for (dfp = ofmt->debug_formats; (df = *dfp); dfp++) {
if (!nasm_stricmp(name, df->shortname))
@@ -85,7 +88,7 @@ struct dfmt *dfmt_find(const struct ofmt *ofmt, char *name)
void ofmt_list(const struct ofmt *deffmt, FILE * fp)
{
const struct ofmt **ofp, *of;
const struct ofmt * const *ofp, *of;
unsigned int i;
/* primary targets first */
@@ -107,7 +110,8 @@ void ofmt_list(const struct ofmt *deffmt, FILE * fp)
void dfmt_list(const struct ofmt *ofmt, FILE *fp)
{
struct dfmt **dfp, *df;
const struct dfmt * const *dfp;
const struct dfmt *df;
for (dfp = ofmt->debug_formats; (df = *dfp); dfp++) {
fprintf(fp, " %c %-10s%s\n",