summaryrefslogtreecommitdiffstats
path: root/usr.bin/indent/indent.c
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2002-03-30 17:10:20 +0000
committerdwmalone <dwmalone@FreeBSD.org>2002-03-30 17:10:20 +0000
commit99e772806a36ae098c6182c10930a22d0e294773 (patch)
tree1711f44fbf118a1272386226ffd60f4cc94cc20c /usr.bin/indent/indent.c
parent02ab2c827dc5bab7d906f77bfdbb34f353f214aa (diff)
downloadFreeBSD-src-99e772806a36ae098c6182c10930a22d0e294773.zip
FreeBSD-src-99e772806a36ae098c6182c10930a22d0e294773.tar.gz
1) Const enough things to avoid warnings.
2) Cast ifdef_level to a size_t before comparing it to a ratio of size_ts. Ifdef_level should always be positive. 3) Complete prototype for chfont. 4) Cast some ptrdiff_ts to ints before using as a field width. 5) Avoid shadowing a local variable p with another local variable p.
Diffstat (limited to 'usr.bin/indent/indent.c')
-rw-r--r--usr.bin/indent/indent.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c
index 71259a8..62310fc 100644
--- a/usr.bin/indent/indent.c
+++ b/usr.bin/indent/indent.c
@@ -63,9 +63,9 @@ static const char rcsid[] =
static void bakcopy(void);
-char *in_name = "Standard Input"; /* will always point to name of input
+const char *in_name = "Standard Input"; /* will always point to name of input
* file */
-char *out_name = "Standard Output"; /* will always point to name
+const char *out_name = "Standard Output"; /* will always point to name
* of output file */
char bakfile[MAXPATHLEN] = "";
@@ -89,7 +89,7 @@ main(int argc, char **argv)
int squest; /* when this is positive, we have seen a ?
* without the matching : in a <c>?<s>:<s>
* construct */
- register char *t_ptr; /* used for copying tokens */
+ const char *t_ptr; /* used for copying tokens */
int type_code; /* the type of token, returned by lexi */
int last_else = 0; /* true iff last keyword was an else */
@@ -267,7 +267,7 @@ main(int argc, char **argv)
ps.ind_level = ps.i_l_follow = col / ps.ind_size;
}
if (troff) {
- register char *p = in_name,
+ const char *p = in_name,
*beg = in_name;
while (*p)
@@ -574,7 +574,7 @@ check_type:
e_code += strlen(e_code);
}
else {
- char *res = token;
+ const char *res = token;
if (ps.in_decl && !ps.block_init) { /* if this is a unary op
* in a declaration, we
@@ -600,7 +600,7 @@ check_type:
if (ps.want_blank)
*e_code++ = ' ';
{
- char *res = token;
+ const char *res = token;
if (troff)
switch (token[0]) {
@@ -1077,7 +1077,7 @@ check_type:
while ((c = getc(input)) == '\n');
ungetc(c, input);
}
- if (ifdef_level < sizeof state_stack / sizeof state_stack[0]) {
+ if ((size_t)ifdef_level < sizeof(state_stack)/sizeof(state_stack[0])) {
match_state[ifdef_level].tos = -1;
state_stack[ifdef_level++] = ps;
}
@@ -1143,7 +1143,7 @@ bakcopy(void)
int n,
bakchn;
char buff[8 * 1024];
- register char *p;
+ const char *p;
/* construct file name .Bfile */
for (p = in_name; *p; p++); /* skip to end of string */
OpenPOWER on IntegriCloud