[m-dev.] trivial diff: use rand instead of random with MSVC

Peter Ross peter.ross at miscrit.be
Thu Dec 7 23:18:21 AEDT 2000


Hi,


===================================================================


Estimated hours taken: 0.1

dbg_mlc.c:
    If we are using MSVC, call rand() instead of random(), as random()
    doesn't exist.


Index: dbg_mlc.c
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/dbg_mlc.c,v
retrieving revision 1.12
diff -u -r1.12 dbg_mlc.c
--- dbg_mlc.c	2000/09/18 11:08:49	1.12
+++ dbg_mlc.c	2000/12/07 11:07:45
@@ -98,10 +98,14 @@
   /* Generate a random heap address.		*/
   /* The resulting address is in the heap, but	*/
   /* not necessarily inside a valid object.	*/
+  #ifdef _MSC_VER
+    #define random()	rand()
+  #endif
   void *GC_generate_random_heap_address(void)
   {
     int i;
     int heap_offset = random() % GC_heapsize;
+
     for (i = 0; i < GC_n_heap_sects; ++ i) {
 	int size = GC_heap_sects[i].hs_bytes;
 	if (heap_offset < size) {

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list