Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : get current backtrace with libunwind (only available with ucontext...
[simgrid.git] / src / xbt / RngStream.c
index 1021e7e..01aa668 100644 (file)
@@ -13,6 +13,7 @@
 
 
 #include "xbt/RngStream.h"
+#include "xbt/sysdep.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -70,19 +71,19 @@ static double A2p0[3][3] = {
           };
 
 static double A1p76[3][3] = {
-          {      82758667.0, 1871391091.0, 4127413238.0 }, 
-          {    3672831523.0,   69195019.0, 1871391091.0 }, 
+          {      82758667.0, 1871391091.0, 4127413238.0 },
+          {    3672831523.0,   69195019.0, 1871391091.0 },
           {    3672091415.0, 3528743235.0,   69195019.0 }
           };
 
 static double A2p76[3][3] = {
-          {    1511326704.0, 3759209742.0, 1610795712.0 }, 
-          {    4292754251.0, 1511326704.0, 3889917532.0 }, 
+          {    1511326704.0, 3759209742.0, 1610795712.0 },
+          {    4292754251.0, 1511326704.0, 3889917532.0 },
           {    3859662829.0, 4292754251.0, 3708466080.0 }
           };
 
 static double A1p127[3][3] = {
-          {    2427906178.0, 3580155704.0,  949770784.0 }, 
+          {    2427906178.0, 3580155704.0,  949770784.0 },
           {     226153695.0, 1230515664.0, 3580155704.0 },
           {    1988835001.0,  986791581.0, 1230515664.0 }
           };
@@ -311,14 +312,14 @@ RngStream RngStream_CreateStream (const char name[])
    RngStream g;
    size_t len;
 
-   g = (RngStream) malloc (sizeof (struct RngStream_InfoState));
+   g = (RngStream) xbt_malloc (sizeof (struct RngStream_InfoState));
    if (g == NULL) {
       printf ("RngStream_CreateStream: No more memory\n\n");
       exit (EXIT_FAILURE);
    }
    if (name) {
       len = strlen (name);
-      g->name = (char *) malloc ((len + 1) * sizeof (char));
+      g->name = (char *) xbt_malloc ((len + 1) * sizeof (char));
       strncpy (g->name, name, len + 1);
    } else
       g->name = 0;
@@ -349,13 +350,13 @@ void RngStream_DeleteStream (RngStream * p)
 RngStream RngStream_CopyStream (const RngStream src)
 {
    RngStream g;
-   
+
    if(src == NULL) {
      printf ("RngStream_CopyStream: 'src' not initialized\n\n");
      exit (EXIT_FAILURE);
    }
 
-   g = (RngStream) malloc (sizeof (struct RngStream_InfoState));
+   g = (RngStream) xbt_malloc (sizeof (struct RngStream_InfoState));
    if (g == NULL) {
       printf ("RngStream_CopyStream: No more memory\n\n");
       exit (EXIT_FAILURE);
@@ -415,7 +416,7 @@ int RngStream_SetSeed (RngStream g, unsigned long seed[6])
       return -1;                    /* FAILURE */
    for (i = 0; i < 6; ++i)
       g->Cg[i] = g->Bg[i] = g->Ig[i] = seed[i];
-   return 0;                       /* SUCCESS */ 
+   return 0;                       /* SUCCESS */
 }
 
 /*-------------------------------------------------------------------------*/