summaryrefslogtreecommitdiff
path: root/lang/baci/patches/patch-aa
blob: a392d1a47d62c4536177afa96be0aaacb485bb60 (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
$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++) {