found a small error with Purify

This commit is contained in:
ceriel 1993-01-18 15:30:54 +00:00
parent bcff9862e7
commit 3b80847a9d
2 changed files with 20 additions and 11 deletions

View file

@ -1,13 +1,10 @@
/* INPUT AND BUFFER HANDLING MODULE */ /* INPUT AND BUFFER HANDLING MODULE */
/* /*
[input.X inp_pkg.spec input.h]
Input buffering module: this module contains the routines that Input buffering module: this module contains the routines that
offers an input buffering mechanism to the user. offers an input buffering mechanism to the user.
This module exports the following objects: This module exports the following objects:
input.h : an include-file, which must be included when using
this module
InsertFile() : suspend input from current buffer and obtain the InsertFile() : suspend input from current buffer and obtain the
next input characters from the specified file next input characters from the specified file
InsertText() : suspend input from current buffer and take the InsertText() : suspend input from current buffer and take the
@ -37,7 +34,12 @@
INP_NPUSHBACK: the number of characters pushback INP_NPUSHBACK: the number of characters pushback
*/ */
#include <alloc.h> #if __STDC__
#include <stdlib.h>
#else
extern char *malloc();
#endif
#include <system.h> #include <system.h>
#ifndef INP_NPUSHBACK #ifndef INP_NPUSHBACK
@ -362,6 +364,7 @@ loadbuf()
register char *de = bh->bh_text; register char *de = bh->bh_text;
register int i = INP_NPUSHBACK - 1; register int i = INP_NPUSHBACK - 1;
if (i >= bh->bh_size) i = bh->bh_size - 1;
while (i-- > 0) { while (i-- > 0) {
/* make sure PushBack will work */ /* make sure PushBack will work */
*--de = *--so; *--de = *--so;
@ -385,6 +388,7 @@ loadbuf()
register char *de = &buf[INP_NPUSHBACK - 1]; register char *de = &buf[INP_NPUSHBACK - 1];
register int i = INP_NPUSHBACK - 1; register int i = INP_NPUSHBACK - 1;
if (i >= bh->bh_size) i = bh->bh_size - 1;
for (;i > 0; i--) { for (;i > 0; i--) {
/* make sure PushBack will work */ /* make sure PushBack will work */
*--de = *--so; *--de = *--so;

View file

@ -22,14 +22,22 @@
#define PushBack() (--_ipp) #define PushBack() (--_ipp)
#define ChPushBack(ch) (*--_ipp = (ch)) #define ChPushBack(ch) (*--_ipp = (ch))
/* EOF may be defined as -1 in most programs but the character -1 may /* EOI may be defined as -1 in most programs but the character -1 may
be expanded to the int -1 which causes troubles at the indexing in be expanded to the int -1 which causes troubles with indexing.
the class or boolean arrays.
*/ */
#define EOI (0200) #define EOI (0200)
extern char *_ipp; extern char *_ipp;
#if __STDC__
int loadbuf(void);
int InsertFile(char *, char **, char **);
int InsertText(char *, int);
#else
extern int loadbuf(); extern int loadbuf();
extern int InsertFile();
extern int InsertText();
#endif
/* int InsertFile(filename, table, result) /* int InsertFile(filename, table, result)
char *filename; char *filename;
@ -41,10 +49,8 @@ extern int loadbuf();
will be looked for in the directories, mentioned in the null-terminated will be looked for in the directories, mentioned in the null-terminated
list indicated by "table". It returns 1 if it succeeds, 0 if it fails. list indicated by "table". It returns 1 if it succeeds, 0 if it fails.
"result" will contain the full path if InsertFile returns 1. "result" will contain the full path if InsertFile returns 1.
*/
extern int InsertFile();
/* int InsertText(text, length) int InsertText(text, length)
char *text; char *text;
int length; int length;
This funtion suspends input from the current input stream. The next This funtion suspends input from the current input stream. The next
@ -52,4 +58,3 @@ extern int InsertFile();
whose length is indicated by "length". whose length is indicated by "length".
It returns 1 if it succeeds, 0 if it fails. It returns 1 if it succeeds, 0 if it fails.
*/ */
extern int InsertText();