Commit 106d7d7d by Richard Stallman

(decl of create_definition): Move forward declaration past the definition of struct macrodef.

(decl of create_definition): Move forward declaration
past the definition of struct macrodef.
(VMS_strncat): New function.

From-SVN: r1915
parent ebea352b
...@@ -86,9 +86,6 @@ typedef unsigned char U_CHAR; ...@@ -86,9 +86,6 @@ typedef unsigned char U_CHAR;
#endif /* USG */ #endif /* USG */
#endif /* not VMS */ #endif /* not VMS */
extern char *index ();
extern char *rindex ();
/* VMS-specific definitions */ /* VMS-specific definitions */
#ifdef VMS #ifdef VMS
#include <time.h> #include <time.h>
...@@ -102,6 +99,8 @@ extern char *rindex (); ...@@ -102,6 +99,8 @@ extern char *rindex ();
#define open(fname,mode,prot) VMS_open(fname,mode,prot) #define open(fname,mode,prot) VMS_open(fname,mode,prot)
#define fopen(fname,mode) VMS_fopen(fname,mode) #define fopen(fname,mode) VMS_fopen(fname,mode)
#define freopen(fname,mode,ofile) VMS_freopen(fname,mode,ofile) #define freopen(fname,mode,ofile) VMS_freopen(fname,mode,ofile)
#define strncat(dst,src,cnt) VMS_strncat(dst,src,cnt)
static char * VMS_strncat ();
static int VMS_read (); static int VMS_read ();
static int VMS_write (); static int VMS_write ();
static int VMS_open (); static int VMS_open ();
...@@ -116,6 +115,9 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t; ...@@ -116,6 +115,9 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t;
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#endif /* VMS */ #endif /* VMS */
extern char *index ();
extern char *rindex ();
#ifndef O_RDONLY #ifndef O_RDONLY
#define O_RDONLY 0 #define O_RDONLY 0
#endif #endif
...@@ -299,7 +301,7 @@ static U_CHAR *skip_quoted_string (); ...@@ -299,7 +301,7 @@ static U_CHAR *skip_quoted_string ();
static U_CHAR *skip_paren_group (); static U_CHAR *skip_paren_group ();
static char *check_precompiled (); static char *check_precompiled ();
static struct macrodef create_definition (); /* static struct macrodef create_definition (); [moved below] */
static void dump_single_macro (); static void dump_single_macro ();
#ifndef FAILURE_EXIT_CODE #ifndef FAILURE_EXIT_CODE
...@@ -595,6 +597,8 @@ struct macrodef ...@@ -595,6 +597,8 @@ struct macrodef
int symlen; int symlen;
}; };
static struct macrodef create_definition ();
/* Structure allocated for every #define. For a simple replacement /* Structure allocated for every #define. For a simple replacement
such as such as
...@@ -8867,4 +8871,23 @@ open (fname, flags, prot) ...@@ -8867,4 +8871,23 @@ open (fname, flags, prot)
return open (fname, flags, prot, "mbc=16", "deq=64", "fop=tef"); return open (fname, flags, prot, "mbc=16", "deq=64", "fop=tef");
} }
/* Avoid run-time library bug, where copying M out of N+M characters with
N >= 65535 results in VAXCRTL's strncat falling into an infinite loop.
gcc-cpp exercises this particular bug. */
static char *
strncat (dst, src, cnt)
char *dst;
const char *src;
unsigned cnt;
{
register char *d = dst, *s = (char *) src;
register int n = cnt; /* convert to _signed_ type */
while (*d) d++; /* advance to end */
while (--n >= 0)
if (!(*d++ = *s++)) break;
if (n < 0) *d = '\0';
return dst;
}
#endif /* VMS */ #endif /* VMS */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment