summaryrefslogtreecommitdiff
path: root/xkbcomp.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-11 15:18:26 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-03 11:02:11 -0800
commit6db8fd556e2562e9a0a821c0d6fd4f7cdcf6266c (patch)
tree45171678d6b1fbfe936bb2586933d3e03c93500a /xkbcomp.c
parent299c9762b1dbe53f3297c54e5526aeae767d1a10 (diff)
Mark more pointers as const
Some suggested by cppcheck, others by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xkbcomp.c')
-rw-r--r--xkbcomp.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/xkbcomp.c b/xkbcomp.c
index 1be264d..6aedb67 100644
--- a/xkbcomp.c
+++ b/xkbcomp.c
@@ -80,12 +80,12 @@ static const char *fileTypeExt[] = {
};
static unsigned inputFormat, outputFormat;
-static char *rootDir;
+static const char *rootDir;
static char *inputFile;
-static char *inputMap;
+static const char *inputMap;
static char *outputFile;
-static char *inDpyName;
-static char *outDpyName;
+static const char *inDpyName;
+static const char *outDpyName;
static Display *inDpy;
static Display *outDpy;
static Bool showImplicit = False;
@@ -96,9 +96,9 @@ unsigned warningLevel = 5;
unsigned verboseLevel = 0;
unsigned dirsToStrip = 0;
static unsigned optionalParts = 0;
-static char *preErrorMsg = NULL;
-static char *postErrorMsg = NULL;
-static char *errorPrefix = NULL;
+static const char *preErrorMsg = NULL;
+static const char *postErrorMsg = NULL;
+static const char *errorPrefix = NULL;
static unsigned int device_id = XkbUseCoreKbd;
/***====================================================================***/
@@ -177,7 +177,7 @@ Usage(int argc, char *argv[])
/***====================================================================***/
static void
-setVerboseFlags(char *str)
+setVerboseFlags(const char *str)
{
for (; *str; str++)
{
@@ -464,7 +464,7 @@ parseArgs(int argc, char *argv[])
}
else
{
- for (char *tmp2 = argv[i]; (*tmp2 != '\0'); tmp2++)
+ for (const char *tmp2 = argv[i]; (*tmp2 != '\0'); tmp2++)
{
switch (*tmp2)
{
@@ -565,7 +565,7 @@ parseArgs(int argc, char *argv[])
}
else if (strncmp(argv[i], "-v", 2) == 0)
{
- char *str;
+ const char *str;
if (argv[i][2] != '\0')
str = &argv[i][2];
else if ((i < (argc - 1)) && (argv[i + 1][0] != '-'))
@@ -776,7 +776,7 @@ parseArgs(int argc, char *argv[])
else if ((outputFile == NULL) && (inputFile != NULL))
{
int len;
- char *base, *ext;
+ const char *base, *ext;
if (inputMap == NULL)
{
@@ -809,9 +809,10 @@ parseArgs(int argc, char *argv[])
else if (outputFile == NULL)
{
int len;
- char *ch, *name, buf[128];
+ char *ch, buf[128];
+ const char *name = buf;
if (inDpyName[0] == ':')
- snprintf(name = buf, sizeof(buf), "server%s", inDpyName);
+ snprintf(buf, sizeof(buf), "server%s", inDpyName);
else
name = inDpyName;
@@ -851,7 +852,7 @@ parseArgs(int argc, char *argv[])
}
static Display *
-GetDisplay(char *program, char *dpyName)
+GetDisplay(const char *program, const char *dpyName)
{
int mjr, mnr, error;
Display *dpy;