summaryrefslogtreecommitdiff
path: root/editors/uemacs/patches/patch-src_eval_c
blob: 556bc7da92f9a71777ca41cc2e75ccad98f74979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
$NetBSD: patch-src_eval_c,v 1.1 2012/05/10 20:53:30 dholland Exp $

- don't use implicit int
- const correctness required by existing const declarations
- return NULL on some unreachable paths
- fix uninitialized variable bug caught by gcc
- silence gcc 4.1 parenthesis warning

--- src/eval.c~	2012-05-10 19:25:36.000000000 +0000
+++ src/eval.c
@@ -68,7 +68,7 @@ UTABLE *ut;	/* table to clear */
 	free(ut);
 }
 
-char *PASCAL NEAR gtfun(fname)	/* evaluate a function */
+CONST char *PASCAL NEAR gtfun(fname)	/* evaluate a function */
 
 char *fname;		/* name of function to evaluate */
 
@@ -237,9 +237,10 @@ char *fname;		/* name of function to eva
 	}
 
 	meexit(-11);	/* never should get here */
+	return NULL;
 }
 
-char *PASCAL NEAR gtusr(vname)	/* look up a user var's value */
+CONST char *PASCAL NEAR gtusr(vname)	/* look up a user var's value */
 
 char *vname;		/* name of user variable to fetch */
 
@@ -299,7 +300,7 @@ int i;
 	return(envars[i]);
 }
 
-PASCAL NEAR binary(key, tval, tlength, klength)
+int PASCAL NEAR binary(key, tval, tlength, klength)
 
 char *key;		/* key string to look for */
 char *(PASCAL NEAR *tval)();	/* ptr to function to fetch table value with */
@@ -331,7 +332,7 @@ int klength;		/* maximum length of strin
 	return(-1);
 }
 
-char *PASCAL NEAR gtenv(vname)
+CONST char *PASCAL NEAR gtenv(vname)
 
 char *vname;		/* name of environment variable to retrieve */
 
@@ -451,11 +452,12 @@ char *vname;		/* name of environment var
 		case EVYPOS:	return(int_asc(ypos));
 	}
 	meexit(-12);	/* again, we should never get here */
+	return NULL;
 }
 
-char *PASCAL NEAR fixnull(s)	/* Don't return NULL pointers! */
+CONST char *PASCAL NEAR fixnull(s)	/* Don't return NULL pointers! */
 
-char *s;
+CONST char *s;
 
 {
 	if (s == NULL)
@@ -753,6 +755,7 @@ int scope;	/* intended scope of any crea
 
 fvar:	vtype = -1;
 	vut = uv_head;
+	vnum = -1;
 
 	switch (var[0]) {
 
@@ -1245,7 +1248,7 @@ char *token;	/* token to analyze */
 	}
 }
 
-char *PASCAL NEAR getval(token) /* find the value of a token */
+CONST char *PASCAL NEAR getval(token) /* find the value of a token */
 
 char *token;		/* token to evaluate */
 
@@ -1316,6 +1319,7 @@ char *token;		/* token to evaluate */
 		case TKSTR:	return(token+1);
 		case TKCMD:	return(token);
 	}
+	return NULL;
 }
 
 int PASCAL NEAR stol(val)	/* convert a string to a numeric logical */
@@ -1333,7 +1337,7 @@ char *val;	/* value to check for stol */
 	return((asc_int(val) != 0));
 }
 
-char *PASCAL NEAR ltos(val)	/* numeric logical to string logical */
+CONST char *PASCAL NEAR ltos(val)	/* numeric logical to string logical */
 
 int val;	/* value to translate */
 
@@ -1470,7 +1474,7 @@ xnext:		++sp;
 /*	setwlist:	Set an alternative list of character to be
 			considered "in a word */
 
-PASCAL NEAR setwlist(wclist)
+VOID PASCAL NEAR setwlist(wclist)
 
 char *wclist;	/* list of characters to consider "in a word" */
 
@@ -1539,7 +1543,7 @@ char *st;
  
 	/* scan digits */
 	period_flag = FALSE;
-	while ((*st >= '0') && (*st <= '9') ||
+	while ((*st >= '0' && *st <= '9') ||
 	       (*st == '.' && period_flag == FALSE)) {
 		if (*st == '.')
 			period_flag = TRUE;
@@ -1605,7 +1609,7 @@ int n;		/* numeric arg (can overide prom
 				of all the environment variables
 */
 
-PASCAL NEAR desvars(f, n)
+int PASCAL NEAR desvars(f, n)
 
 int f,n;	/* prefix flag and argument */