X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/51d922ae7d6e523ef9edb33d51fb81028c24b577..4b52501b4cd5c33e7180075998e85b6478450cb5:/src/xbt/RngStream.c?ds=sidebyside diff --git a/src/xbt/RngStream.c b/src/xbt/RngStream.c index a5a33134c6..e4dbbb5a74 100644 --- a/src/xbt/RngStream.c +++ b/src/xbt/RngStream.c @@ -1,3 +1,9 @@ +/* Copyright (c) 2012, 2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + /***********************************************************************\ * * File: RngStream.c for multiple streams of Random Numbers @@ -13,6 +19,7 @@ #include "xbt/RngStream.h" +#include "xbt/sysdep.h" #include #include #include @@ -311,14 +318,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; @@ -355,7 +362,7 @@ RngStream RngStream_CopyStream (const RngStream src) 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); @@ -538,15 +545,3 @@ int RngStream_RandInt (RngStream g, int i, int j) { return i + (int) ((j - i + 1.0) * RngStream_RandU01 (g)); } - -/* Undefine this terms, or supernovae build will fail. */ -#undef norm -#undef m1 -#undef m2 -#undef a12 -#undef a13n -#undef a21 -#undef a23n -#undef two17 -#undef two53 -#undef fact