256 lines
4.3 KiB
Plaintext
256 lines
4.3 KiB
Plaintext
$NetBSD: patch-ex__temp_c,v 1.1 2012/12/28 03:03:08 dholland Exp $
|
|
|
|
- declare local functions static
|
|
- declare void functions void
|
|
- avoid implicit int
|
|
- silence warnings about assignments in conditionals
|
|
- silence signed/unsigned compiler warning
|
|
- return values from non-void functions
|
|
|
|
--- ex_temp.c~ 2012-12-27 21:58:41.000000000 +0000
|
|
+++ ex_temp.c
|
|
@@ -106,11 +106,14 @@ int havetmp;
|
|
int tfile = -1;
|
|
int rfile = -1;
|
|
|
|
-int YANKline __P((void));
|
|
-int rbflush __P((void));
|
|
-int blkio __P((bloc, char *, ssize_t (*) __P((int, void *, size_t))));
|
|
-char *getblock __P((line, int));
|
|
+static void YANKline __P((void));
|
|
+static void rbflush __P((void));
|
|
+static void blkio __P((bloc, char *, ssize_t (*) __P((int, void *, size_t))));
|
|
+static char *getblock __P((line, int));
|
|
+static ssize_t shread __P((void));
|
|
+static int getREG __P((void));
|
|
|
|
+void
|
|
fileinit()
|
|
{
|
|
register char *p;
|
|
@@ -196,6 +199,7 @@ dumbness:
|
|
/* brk((char *)fendcore); */
|
|
}
|
|
|
|
+void
|
|
cleanup(all)
|
|
bool all;
|
|
{
|
|
@@ -213,6 +217,7 @@ cleanup(all)
|
|
}
|
|
}
|
|
|
|
+void
|
|
get_line(tl)
|
|
line tl;
|
|
{
|
|
@@ -223,13 +228,14 @@ get_line(tl)
|
|
bp = getblock(tl, READ);
|
|
nl = nleft;
|
|
tl &= ~OFFMSK;
|
|
- while (*lp++ = *bp++)
|
|
+ while ((*lp++ = *bp++) != 0)
|
|
if (--nl == 0) {
|
|
bp = getblock(tl += INCRMT, READ);
|
|
nl = nleft;
|
|
}
|
|
}
|
|
|
|
+int
|
|
putline()
|
|
{
|
|
register char *bp, *lp;
|
|
@@ -243,7 +249,7 @@ putline()
|
|
bp = getblock(tl, WRITE);
|
|
nl = nleft;
|
|
tl &= ~OFFMSK;
|
|
- while (*bp = *lp++) {
|
|
+ while ((*bp = *lp++) != 0) {
|
|
if (*bp++ == '\n') {
|
|
*--bp = 0;
|
|
linebp = lp;
|
|
@@ -264,7 +270,7 @@ ssize_t read __P((int, void *, size_t));
|
|
ssize_t write __P((int, void *, size_t));
|
|
#endif
|
|
|
|
-char *
|
|
+static char *
|
|
getblock(atl, iof)
|
|
line atl;
|
|
int iof;
|
|
@@ -321,8 +327,8 @@ char incorb[INCORB+1][BUFSIZ];
|
|
bloc stilinc; /* up to here not written yet */
|
|
#endif
|
|
|
|
+static void
|
|
#ifdef __STDC__
|
|
-int
|
|
blkio(bloc b, char *buf, ssize_t (*iofcn)(int, void *, size_t))
|
|
#else /* !__STDC__ */
|
|
blkio(b, buf, iofcn)
|
|
@@ -353,6 +359,7 @@ blkio(b, buf, iofcn)
|
|
}
|
|
|
|
#ifdef INCORB
|
|
+void
|
|
tlaste()
|
|
{
|
|
|
|
@@ -360,6 +367,7 @@ tlaste()
|
|
dirtcnt = 0;
|
|
}
|
|
|
|
+void
|
|
tflush()
|
|
{
|
|
bbloc i = stilinc;
|
|
@@ -375,6 +383,7 @@ tflush()
|
|
* Synchronize the state of the temporary file in case
|
|
* a crash occurs.
|
|
*/
|
|
+void
|
|
synctmp()
|
|
{
|
|
register bbloc cnt;
|
|
@@ -438,6 +447,7 @@ oops:
|
|
#endif
|
|
}
|
|
|
|
+void
|
|
TSYNC()
|
|
{
|
|
|
|
@@ -493,6 +503,7 @@ short rblock;
|
|
short rnext;
|
|
char *rbufcp;
|
|
|
|
+static void
|
|
regio(b, iofcn)
|
|
short b;
|
|
ssize_t (*iofcn) __P((int, void *, size_t));
|
|
@@ -542,11 +553,12 @@ oops:
|
|
rblock = b;
|
|
}
|
|
|
|
+static int
|
|
REGblk()
|
|
{
|
|
register int i, j, m;
|
|
|
|
- for (i = 0; i < sizeof rused / sizeof rused[0]; i++) {
|
|
+ for (i = 0; i < (int)(sizeof rused / sizeof rused[0]); i++) {
|
|
m = (rused[i] ^ 0177777) & 0177777;
|
|
if (i == 0)
|
|
m &= ~1;
|
|
@@ -562,10 +574,11 @@ REGblk()
|
|
}
|
|
}
|
|
error(catgets(catd, 1, 186, "Out of register space (ugh)"));
|
|
- /*NOTREACHED*/
|
|
+ /* XXX what do we do here? */
|
|
+ return 0;
|
|
}
|
|
|
|
-struct strreg *
|
|
+static struct strreg *
|
|
mapreg(c)
|
|
register int c;
|
|
{
|
|
@@ -575,8 +588,7 @@ mapreg(c)
|
|
return (isdigit(c) ? &strregs[('z'-'a'+1)+(c-'0')] : &strregs[c-'a']);
|
|
}
|
|
|
|
-ssize_t shread();
|
|
-
|
|
+static void
|
|
KILLreg(c)
|
|
register int c;
|
|
{
|
|
@@ -598,8 +610,8 @@ KILLreg(c)
|
|
}
|
|
|
|
/*VARARGS*/
|
|
-ssize_t
|
|
-shread()
|
|
+static ssize_t
|
|
+shread(void)
|
|
{
|
|
struct front { short a; short b; };
|
|
|
|
@@ -608,9 +620,8 @@ shread()
|
|
return (0);
|
|
}
|
|
|
|
-int getREG();
|
|
-
|
|
-putreg(c)
|
|
+void
|
|
+putreg(int c)
|
|
{
|
|
register line *odot = dot;
|
|
register line *odol = dol;
|
|
@@ -651,12 +662,14 @@ putreg(c)
|
|
notecnt = cnt;
|
|
}
|
|
|
|
-partreg(c)
|
|
+int
|
|
+partreg(int c)
|
|
{
|
|
|
|
return (mapreg(c)->rg_flags);
|
|
}
|
|
|
|
+void
|
|
notpart(c)
|
|
register int c;
|
|
{
|
|
@@ -665,6 +678,7 @@ notpart(c)
|
|
mapreg(c)->rg_flags = 0;
|
|
}
|
|
|
|
+static int
|
|
getREG()
|
|
{
|
|
register char *lp = linebuf;
|
|
@@ -691,6 +705,7 @@ getREG()
|
|
}
|
|
}
|
|
|
|
+void
|
|
YANKreg(c)
|
|
register int c;
|
|
{
|
|
@@ -729,6 +744,7 @@ YANKreg(c)
|
|
CP(linebuf,savelb);
|
|
}
|
|
|
|
+void
|
|
kshift()
|
|
{
|
|
register int i;
|
|
@@ -738,6 +754,7 @@ kshift()
|
|
copy(mapreg(i+1), mapreg(i), sizeof (struct strreg));
|
|
}
|
|
|
|
+static void
|
|
YANKline()
|
|
{
|
|
register char *lp = linebuf;
|
|
@@ -764,6 +781,7 @@ YANKline()
|
|
*rbufcp = 0;
|
|
}
|
|
|
|
+static void
|
|
rbflush()
|
|
{
|
|
register struct strreg *sp = strp;
|
|
@@ -778,6 +796,7 @@ rbflush()
|
|
}
|
|
|
|
/* Register c to char buffer buf of size buflen */
|
|
+void
|
|
regbuf(c, buf, buflen)
|
|
char c;
|
|
char *buf;
|