summaryrefslogtreecommitdiff
path: root/lang/baci/patches/patch-ab
blob: 5cb854d910b7aa07ede528742300854fb5da90a3 (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
$NetBSD: patch-ab,v 1.3 2015/12/29 23:34:43 dholland Exp $

Use standard headers.
Don't redeclare standard functions.
Avoid symbol name conflict with random().

--- interp/baiutils.c.orig	1999-08-31 18:19:18.000000000 +0200
+++ interp/baiutils.c
@@ -1,6 +1,7 @@
  /* BenAri Concurrent PCODE Interpreter Utilities */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 
@@ -10,12 +11,7 @@
 #include "random.h"
 #include "bainterp.h"
 
-extern int fprintf(FILE*,const char*,...);
-extern int fclose(FILE*);
-extern int printf(const char*,...);
-extern int atoi(char*);
 extern int build_cbtab();
-extern int sscanf(const char*, const char*,...);
 
 FNAME_STRING interp_pname;
 
@@ -171,8 +167,8 @@ void chooseproc()
 
    d = PMAXP1;
    suspended = active = 0;
-   look = random(PMAXP1);
-   add = 1 + random(PMAX); /* 1 <= add <= PMAXP1 */
+   look = __random(PMAXP1);
+   add = 1 + __random(PMAX); /* 1 <= add <= PMAXP1 */
    while ( ((!ptab[look].active) || (ptab[look].suspend>=0) ||
             (ptab[look].tabix < 0)) && (d >= 0) ){
 /* keep looking until a called process that is active and not
@@ -189,7 +185,7 @@ void chooseproc()
       ps = deadlock;
    }
    else {
-      stepcount = random(STEPMAXP1);
+      stepcount = __random(STEPMAXP1);
       if (ptab[curpr].atomic){
          if (ptab[curpr].suspend >= 0) {
             ps = deadlock;