constify.

This commit is contained in:
christos 2005-06-26 22:45:50 +00:00
parent 79f5327ef7
commit 6499bd69c1
6 changed files with 29 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: keysym.c,v 1.5 2005/01/19 20:37:52 xtraeme Exp $ */
/* $NetBSD: keysym.c,v 1.6 2005/06/26 22:45:50 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -97,25 +97,27 @@ static void sort_ksym_tab(void);
static int
qcmp_name(const void *a, const void *b)
{
return(strcmp(((struct ksym *) a)->name, ((struct ksym *) b)->name));
return(strcmp(((const struct ksym *) a)->name,
((const struct ksym *) b)->name));
}
static int
qcmp_ksym(const void *a, const void *b)
{
return(((struct ksym *) b)->value - ((struct ksym *) a)->value);
return(((const struct ksym *) b)->value -
((const struct ksym *) a)->value);
}
static int
bcmp_name(const void *a, const void *b)
{
return(strcmp((char *) a, ((struct ksym *) b)->name));
return(strcmp((const char *) a, ((const struct ksym *) b)->name));
}
static int
bcmp_ksym(const void *a, const void *b)
{
return(((struct ksym *) b)->value - *((int *) a));
return(((const struct ksym *) b)->value - *((const int *) a));
}
static void
@ -132,7 +134,7 @@ sort_ksym_tab(void)
first_time = 0;
}
char *
const char *
ksym2name(int k)
{
static char tmp[20];

View File

@ -1,4 +1,4 @@
/* $NetBSD: map_parse.y,v 1.4 2005/01/19 20:37:52 xtraeme Exp $ */
/* $NetBSD: map_parse.y,v 1.5 2005/06/26 22:45:50 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -197,7 +197,7 @@ keysym_var : T_KEYSYM_VAR = {
%%
void
yyerror(char *msg)
yyerror(const char *msg)
{
errx(1, "parse: %s", msg);
}

View File

@ -1,6 +1,6 @@
#! /bin/sh
#
# $NetBSD: mkkeysym.sh,v 1.1 1998/12/28 14:01:17 hannken Exp $
# $NetBSD: mkkeysym.sh,v 1.2 2005/06/26 22:45:50 christos Exp $
#
# Build a table of keysyms from a file describing keysyms as:
#
@ -16,7 +16,7 @@ ${AWK} '
BEGIN {
in_decl = 0;
printf("/* DO NOT EDIT: AUTOMATICALLY GENERATED FROM '$1' */\n\n");
printf("struct ksym {\n\tchar *name;\n\tint value;\n};\n\n");
printf("struct ksym {\n\tconst char *name;\n\tint value;\n};\n\n");
printf("struct ksym ksym_tab_by_name[] = {\n");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.22 2005/01/31 06:24:08 joff Exp $ */
/* $NetBSD: util.c,v 1.23 2005/06/26 22:45:50 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -52,7 +52,7 @@ extern struct wskbd_map_data newkbmap; /* from map_parse.y */
struct nameint {
int value;
char *name;
const char *name;
};
static struct nameint kbtype_tab[] = {
@ -166,7 +166,7 @@ static struct nameint attr_tab[] = {
static struct field *field_tab;
static int field_tab_len;
static char *int2name(int, int, struct nameint *, int);
static const char *int2name(int, int, struct nameint *, int);
static int name2int(char *, struct nameint *, int);
static void print_kmap(struct wskbd_map_data *);
@ -210,7 +210,7 @@ field_disable_by_value(void *addr)
f->flags |= FLG_DISABLED;
}
static char *
static const char *
int2name(int val, int uflag, struct nameint *tab, int len)
{
static char tmp[20];
@ -239,9 +239,9 @@ name2int(char *val, struct nameint *tab, int len)
}
void
pr_field(struct field *f, char *sep)
pr_field(struct field *f, const char *sep)
{
char *p;
const char *p;
u_int flags;
int first, i, mask;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsconsctl.c,v 1.12 2005/06/02 00:15:02 lukem Exp $ */
/* $NetBSD: wsconsctl.c,v 1.13 2005/06/26 22:45:50 christos Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@ -55,17 +55,17 @@ extern int keyboard_field_tab_len;
extern int mouse_field_tab_len;
extern int display_field_tab_len;
static void usage(char *);
static void usage(const char *) __attribute__((__noreturn__));
static void
usage(char *msg)
usage(const char *msg)
{
const char *progname = getprogname();
if (msg != NULL)
fprintf(stderr, "%s: %s\n\n", progname, msg);
fprintf(stderr, "usage: %s [-kmd] [-f file] [-n] name ...\n",
fprintf(stderr, "Usage: %s [-kmd] [-f file] [-n] name ...\n",
progname);
fprintf(stderr, " -or- %s [-kmd] [-f file] [-n] -w name=value ...\n",
progname);
@ -81,7 +81,8 @@ main(int argc, char **argv)
{
int i, ch, fd;
int aflag, dflag, kflag, mflag, wflag;
char *file, *sep, *p;
char *p;
const char *sep, *file;
struct field *f, *field_tab;
int do_merge, field_tab_len;
void (*getval)(int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsconsctl.h,v 1.7 2005/01/19 20:37:53 xtraeme Exp $ */
/* $NetBSD: wsconsctl.h,v 1.8 2005/06/26 22:45:50 christos Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
#define WSATTR_WSCOLORS 16
struct field {
char *name;
const char *name;
void *valp;
#define FMT_UINT 1 /* unsigned integer */
#define FMT_STRING 2 /* zero terminated string */
@ -83,10 +83,10 @@ void field_setup(struct field *, int);
struct field *field_by_name(char *);
struct field *field_by_value(void *);
void field_disable_by_value(void *);
void pr_field(struct field *, char *);
void pr_field(struct field *, const char *);
void rd_field(struct field *, char *, int);
int name2ksym(char *);
char *ksym2name(int);
const char *ksym2name(int);
keysym_t ksym_upcase(keysym_t);
void keyboard_get_values(int);
void keyboard_put_values(int);
@ -97,6 +97,6 @@ void display_put_values(int);
#ifndef YYEMPTY
int yyparse(void);
#endif
void yyerror(char *);
void yyerror(const char *);
int yylex(void);
void map_scan_setinput(char *);