Const poisoning.
This commit is contained in:
parent
c1f62bbe29
commit
3e51d2b759
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: backupfile.c,v 1.10 2003/05/30 23:08:12 kristerw Exp $ */
|
||||
/* $NetBSD: backupfile.c,v 1.11 2003/07/08 01:55:35 kristerw Exp $ */
|
||||
|
||||
/* backupfile.c -- make Emacs style backup file names
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: backupfile.c,v 1.10 2003/05/30 23:08:12 kristerw Exp $");
|
||||
__RCSID("$NetBSD: backupfile.c,v 1.11 2003/07/08 01:55:35 kristerw Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -51,16 +51,16 @@ enum backup_type backup_type = none;
|
||||
|
||||
/* The extension added to file names to produce a simple (as opposed
|
||||
to numbered) backup file name. */
|
||||
char *simple_backup_suffix = "~";
|
||||
const char *simple_backup_suffix = "~";
|
||||
|
||||
/* backupfile.c */
|
||||
static int max_backup_version(char *, char *);
|
||||
static char *make_version_name(char *, int);
|
||||
static int version_number(char *, char *, size_t);
|
||||
static char *concat(char *, char *);
|
||||
static char *dirname(char *);
|
||||
static int argmatch(char *, char **);
|
||||
static void invalid_arg(char *, char *, int);
|
||||
static char *concat(const char *, const char *);
|
||||
static char *dirname(const char *);
|
||||
static int argmatch(char *, const char **);
|
||||
static void invalid_arg(const char *, const char *, int);
|
||||
|
||||
/* Return the name of the new backup file for file FILE,
|
||||
allocated with malloc.
|
||||
@ -164,7 +164,7 @@ version_number(char *base, char *backup, size_t base_length)
|
||||
/* Return the newly-allocated concatenation of STR1 and STR2. */
|
||||
|
||||
static char *
|
||||
concat(char *str1, char *str2)
|
||||
concat(const char *str1, const char *str2)
|
||||
{
|
||||
char *newstr;
|
||||
char str1_length = strlen (str1);
|
||||
@ -192,7 +192,7 @@ basename(char *name)
|
||||
removed. */
|
||||
|
||||
static char *
|
||||
dirname(char *path)
|
||||
dirname(const char *path)
|
||||
{
|
||||
char *newpath;
|
||||
char *slash;
|
||||
@ -225,7 +225,7 @@ dirname(char *path)
|
||||
or -2 if it is ambiguous (is a prefix of more than one element). */
|
||||
|
||||
static int
|
||||
argmatch(char *arg, char **optlist)
|
||||
argmatch(char *arg, const char **optlist)
|
||||
{
|
||||
int i; /* Temporary index in OPTLIST. */
|
||||
size_t arglen; /* Length of ARG. */
|
||||
@ -262,7 +262,7 @@ argmatch(char *arg, char **optlist)
|
||||
PROBLEM is the return value from argmatch. */
|
||||
|
||||
static void
|
||||
invalid_arg(char *kind, char *value, int problem)
|
||||
invalid_arg(const char *kind, const char *value, int problem)
|
||||
{
|
||||
fprintf (stderr, "patch: ");
|
||||
if (problem == -1)
|
||||
@ -272,7 +272,7 @@ invalid_arg(char *kind, char *value, int problem)
|
||||
fprintf (stderr, " %s `%s'\n", kind, value);
|
||||
}
|
||||
|
||||
static char *backup_args[] =
|
||||
static const char *backup_args[] =
|
||||
{
|
||||
"never", "simple", "nil", "existing", "t", "numbered", 0
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: backupfile.h,v 1.4 2002/03/08 21:57:33 kristerw Exp $ */
|
||||
/* $NetBSD: backupfile.h,v 1.5 2003/07/08 01:55:35 kristerw Exp $ */
|
||||
|
||||
/* backupfile.h -- declarations for making Emacs style backup file names
|
||||
Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
@ -29,7 +29,7 @@ enum backup_type
|
||||
};
|
||||
|
||||
extern enum backup_type backup_type;
|
||||
extern char *simple_backup_suffix;
|
||||
extern const char *simple_backup_suffix;
|
||||
|
||||
char *find_backup_file_name(char *);
|
||||
enum backup_type get_version(char *);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: inp.c,v 1.13 2003/05/30 22:33:58 kristerw Exp $ */
|
||||
/* $NetBSD: inp.c,v 1.14 2003/07/08 01:55:35 kristerw Exp $ */
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: inp.c,v 1.13 2003/05/30 22:33:58 kristerw Exp $");
|
||||
__RCSID("$NetBSD: inp.c,v 1.14 2003/07/08 01:55:35 kristerw Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "EXTERN.h"
|
||||
@ -81,7 +81,7 @@ plan_a(char *filename)
|
||||
/* I can't write to it. */
|
||||
((filestat.st_mode & 0022) == 0 && filestat.st_uid != myuid)) {
|
||||
struct stat cstat;
|
||||
char *cs = NULL;
|
||||
const char *cs = NULL;
|
||||
char *filebase;
|
||||
size_t pathlen;
|
||||
|
||||
@ -215,7 +215,7 @@ plan_a(char *filename)
|
||||
/*
|
||||
* Fetch a line from the input file, \n terminated, not necessarily \0.
|
||||
*/
|
||||
char *
|
||||
const char *
|
||||
ifetch(LINENUM line)
|
||||
{
|
||||
if (line < 1 || line > input_lines)
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* $NetBSD: inp.h,v 1.7 2003/05/30 22:33:58 kristerw Exp $ */
|
||||
/* $NetBSD: inp.h,v 1.8 2003/07/08 01:55:35 kristerw Exp $ */
|
||||
|
||||
EXT LINENUM input_lines INIT(0); /* how long is input file in lines */
|
||||
EXT LINENUM last_frozen_line INIT(0); /* how many input lines have been */
|
||||
/* irretractibly output */
|
||||
void re_input(void);
|
||||
void scan_input(char *);
|
||||
char *ifetch(LINENUM);
|
||||
const char *ifetch(LINENUM);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: patch.c,v 1.17 2003/05/30 23:08:13 kristerw Exp $ */
|
||||
/* $NetBSD: patch.c,v 1.18 2003/07/08 01:55:35 kristerw Exp $ */
|
||||
|
||||
/* patch - a program to apply diffs to original files
|
||||
*
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: patch.c,v 1.17 2003/05/30 23:08:13 kristerw Exp $");
|
||||
__RCSID("$NetBSD: patch.c,v 1.18 2003/07/08 01:55:35 kristerw Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "INTERN.h"
|
||||
@ -55,7 +55,7 @@ static void copy_till(LINENUM);
|
||||
static void spew_output(void);
|
||||
static void dump_line(LINENUM);
|
||||
static bool patch_match(LINENUM, LINENUM, LINENUM);
|
||||
static bool similar(char *, char *, size_t);
|
||||
static bool similar(const char *, const char *, size_t);
|
||||
int main(int, char *[]);
|
||||
|
||||
/* TRUE if -E was specified on command line. */
|
||||
@ -86,7 +86,7 @@ main(int argc, char *argv[])
|
||||
/* Cons up the names of the temporary files. */
|
||||
{
|
||||
/* Directory for temporary files. */
|
||||
char *tmpdir;
|
||||
const char *tmpdir;
|
||||
size_t tmpname_len;
|
||||
|
||||
tmpdir = getenv ("TMPDIR");
|
||||
@ -375,7 +375,7 @@ nextarg(void)
|
||||
/* Module for handling of long options. */
|
||||
|
||||
struct option {
|
||||
char *long_opt;
|
||||
const char *long_opt;
|
||||
char short_opt;
|
||||
};
|
||||
|
||||
@ -630,8 +630,8 @@ abort_hunk(void)
|
||||
LINENUM newfirst = pch_newfirst() + last_offset;
|
||||
LINENUM oldlast = oldfirst + pch_ptrn_lines() - 1;
|
||||
LINENUM newlast = newfirst + pch_repl_lines() - 1;
|
||||
char *stars = (diff_type >= NEW_CONTEXT_DIFF ? " ****" : "");
|
||||
char *minuses = (diff_type >= NEW_CONTEXT_DIFF ? " ----" : " -----");
|
||||
const char *stars = (diff_type >= NEW_CONTEXT_DIFF ? " ****" : "");
|
||||
const char *minuses = (diff_type >= NEW_CONTEXT_DIFF ? " ----" : " -----");
|
||||
|
||||
fprintf(rejfp, "***************\n");
|
||||
for (i=0; i<=pat_end; i++) {
|
||||
@ -838,7 +838,7 @@ spew_output(void)
|
||||
static void
|
||||
dump_line(LINENUM line)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
char R_newline = '\n';
|
||||
|
||||
/* Note: string is not null terminated. */
|
||||
@ -872,7 +872,7 @@ patch_match(LINENUM base, LINENUM offset, LINENUM fuzz)
|
||||
/* Do two lines match with canonicalized white space? */
|
||||
|
||||
static bool
|
||||
similar(char *a, char *b, size_t len)
|
||||
similar(const char *a, const char *b, size_t len)
|
||||
{
|
||||
while (len) {
|
||||
if (isspace((unsigned char)*b)) {/* whitespace (or \n) to match? */
|
||||
|
Loading…
Reference in New Issue
Block a user