summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2007-07-17 13:27:50 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2007-07-17 13:27:50 -0700
commit658d0022a87c5d3afe3e006e539c5c1b981a8d73 (patch)
tree32a42bdafe028982f8b76300a40fec62981cbd34
parentb7aafba248db5e9c3ba39e4819d0b9ae156d2c82 (diff)
Constify some simple cases
-rw-r--r--handle.c30
-rw-r--r--pf.c4
-rw-r--r--xmodmap.c2
-rw-r--r--xmodmap.h6
4 files changed, 21 insertions, 21 deletions
diff --git a/handle.c b/handle.c
index 6992a8b..61e819f 100644
--- a/handle.c
+++ b/handle.c
@@ -78,7 +78,7 @@ KeysymToKeycodes(Display *dpy, KeySym keysym, int *pnum_kcs)
}
static char *
-copy_to_scratch(char *s, int len)
+copy_to_scratch(const char *s, int len)
{
static char *buf = NULL;
static int buflen = 0;
@@ -121,19 +121,19 @@ initialize_map (void)
static void do_keycode ( char *line, int len );
static void do_keysym ( char *line, int len );
-static void finish_keycodes ( char *line, int len, KeyCode *keycodes,
+static void finish_keycodes ( const char *line, int len, KeyCode *keycodes,
int count );
static void do_add ( char *line, int len );
static void do_remove ( char *line, int len );
static void do_clear ( char *line, int len );
static void do_pointer ( char *line, int len );
-static int get_keysym_list ( char *line, int len, int *np, KeySym **kslistp );
+static int get_keysym_list ( const char *line, int len, int *np, KeySym **kslistp );
static void print_opcode(union op *op);
-static int skip_word ( char *s, int len );
-static int skip_chars ( char *s, int len );
-static int skip_space ( char *s, int len );
+static int skip_word ( const char *s, int len );
+static int skip_chars ( const char *s, int len );
+static int skip_space ( const char *s, int len );
static struct dt {
char *command; /* name of input command */
@@ -188,7 +188,7 @@ handle_line(char *line, /* string to parse */
*/
static int
-skip_word (char *s, int len)
+skip_word (const char *s, int len)
{
register int n;
@@ -197,7 +197,7 @@ skip_word (char *s, int len)
}
static int
-skip_chars(char *s, int len)
+skip_chars(const char *s, int len)
{
register int i;
@@ -210,7 +210,7 @@ skip_chars(char *s, int len)
}
static int
-skip_space(char *s, int len)
+skip_space(const char *s, int len)
{
register int i;
@@ -224,7 +224,7 @@ skip_space(char *s, int len)
static int
-skip_until_char(char *s, int len, char c)
+skip_until_char(const char *s, int len, char c)
{
register int i;
@@ -267,7 +267,7 @@ add_to_work_queue(union op *p) /* this can become a macro someday */
}
static Bool
-parse_number(char *str, unsigned long *val)
+parse_number(const char *str, unsigned long *val)
{
char *fmt = "%ld";
@@ -287,7 +287,7 @@ parse_number(char *str, unsigned long *val)
}
static Bool
-parse_keysym(char *line, int n, char **name, KeySym *keysym)
+parse_keysym(const char *line, int n, char **name, KeySym *keysym)
{
*name = copy_to_scratch (line, n);
if (!strcmp(*name, "NoSymbol")) {
@@ -400,7 +400,7 @@ do_keysym(char *line, int len)
}
static void
-finish_keycodes(char *line, int len, KeyCode *keycodes, int count)
+finish_keycodes(const char *line, int len, KeyCode *keycodes, int count)
{
int n;
KeySym *kslist;
@@ -792,7 +792,7 @@ do_clear(char *line, int len)
}
static int
-strncmp_nocase(char *a, char *b, int n)
+strncmp_nocase(const char *a, const char *b, int n)
{
int i;
int a1, b1;
@@ -908,7 +908,7 @@ do_pointer(char *line, int len)
*/
static int
-get_keysym_list(char *line, int len, int *np, KeySym **kslistp)
+get_keysym_list(const char *line, int len, int *np, KeySym **kslistp)
{
int havesofar, maxcanhave;
KeySym *keysymlist;
diff --git a/pf.c b/pf.c
index 3862a7c..e97a4bf 100644
--- a/pf.c
+++ b/pf.c
@@ -34,10 +34,10 @@ from The Open Group.
#include "xmodmap.h"
#define NOTINFILEFILENAME "commandline"
-char *inputFilename = NOTINFILEFILENAME;
+const char *inputFilename = NOTINFILEFILENAME;
int lineno = 0;
-void process_file (char *filename) /* NULL means use stdin */
+void process_file (const char *filename) /* NULL means use stdin */
{
FILE *fp;
char buffer[BUFSIZ];
diff --git a/xmodmap.c b/xmodmap.c
index c59f07b..fa50781 100644
--- a/xmodmap.c
+++ b/xmodmap.c
@@ -35,7 +35,7 @@ from The Open Group.
#include <ctype.h>
#include "xmodmap.h"
-char *ProgramName;
+const char *ProgramName;
Display *dpy = NULL;
int min_keycode, max_keycode;
Bool verbose = False;
diff --git a/xmodmap.h b/xmodmap.h
index d52ef5e..e020358 100644
--- a/xmodmap.h
+++ b/xmodmap.h
@@ -28,17 +28,17 @@ from The Open Group.
*/
/* $XFree86: xc/programs/xmodmap/xmodmap.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */
-extern char *ProgramName;
+extern const char *ProgramName;
extern Display *dpy;
extern int min_keycode, max_keycode;
extern Bool verbose;
extern Bool dontExecute;
-extern char *inputFilename;
+extern const char *inputFilename;
extern int lineno;
extern int parse_errors;
extern void initialize_map(void);
-extern void process_file(char *filename);
+extern void process_file(const char *filename);
extern void process_line(char *buffer);
extern void handle_line(char *line, int len);
extern void print_work_queue(void);