71 lines
2.3 KiB
Text
71 lines
2.3 KiB
Text
$NetBSD: patch-aa,v 1.3 2007/08/01 20:40:42 joerg Exp $
|
|
|
|
--- interp/bainterp.c.orig 1999-08-31 16:19:18.000000000 +0000
|
|
+++ interp/bainterp.c
|
|
@@ -2,7 +2,7 @@
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
-#include <malloc.h>
|
|
+#include <stdlib.h>
|
|
#include <assert.h>
|
|
|
|
#include "../include/bacicnty.h" /* for PMAX, PMAXP1 */
|
|
@@ -14,13 +14,6 @@
|
|
#include "random.h"
|
|
#include "bainterp.h"
|
|
|
|
-extern int printf(const char*,...);
|
|
-extern int fprintf(FILE*,const char*,...);
|
|
-extern int fputc(int,FILE*);
|
|
-extern int fputs(const char*,FILE*);
|
|
-extern int fseek(FILE*,long,int);
|
|
-extern int sscanf(const char*,const char*,...);
|
|
-
|
|
/* interpreter global variables */
|
|
extern char interp_pname[];
|
|
extern char interp_pnroot[];
|
|
@@ -240,8 +233,8 @@ void interpret()
|
|
else {
|
|
ptab[curpr].t--;
|
|
h2 = PMAXP1; /* code like chooseproc */
|
|
- h3 = random(h2);
|
|
- h4 = 1 + random(PMAX);
|
|
+ h3 = __random(h2);
|
|
+ h4 = 1 + __random(PMAX);
|
|
while (( h2 >= 0 ) && (ptab[h3].suspend != h1 )){
|
|
h3 = (h3+h4) % (PMAXP1);
|
|
h2--;
|
|
@@ -294,8 +287,8 @@ void interpret()
|
|
else { /* semaphore was initialized */
|
|
ptab[curpr].monitor = 0;
|
|
h2 = PMAXP1;
|
|
- h3 = random(h2);
|
|
- h5 = 1 + random(PMAX);
|
|
+ h3 = __random(h2);
|
|
+ h5 = 1 + __random(PMAX);
|
|
while ((h2 >= 0) &&
|
|
((ptab[h3].monitor != h4) || (ptab[h3].suspend >= 0 ))){
|
|
h3 = (h3 + h5) % (PMAXP1);
|
|
@@ -319,8 +312,8 @@ void interpret()
|
|
ptab[curpr].active = 0;
|
|
stepcount = 0;
|
|
h2 = PMAXP1;
|
|
- h3 = random(h2);
|
|
- h5 = 1 + random(PMAX);
|
|
+ h3 = __random(h2);
|
|
+ h5 = 1 + __random(PMAX);
|
|
while ((h2 >= 0) &&
|
|
((ptab[h3].monitor != h4) || (ptab[h3].suspend >=0 ))){
|
|
h3 = (h3 + h5) % (PMAXP1);
|
|
@@ -339,8 +332,8 @@ void interpret()
|
|
else { /* monitor sem was OK */
|
|
h1 = s[ptab[curpr].t];
|
|
ptab[curpr].t--;
|
|
- h3 = random(PMAXP1);
|
|
- h6 = 1 + random(PMAX);
|
|
+ h3 = __random(PMAXP1);
|
|
+ h6 = 1 + __random(PMAX);
|
|
h5 = 0;
|
|
minprior = MAXPRIO;
|
|
for (h2 = 0; h2 <= PMAX; h2++) {
|