Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add haiku support. Because why not.
[simgrid.git] / teshsuite / smpi / mpich3-test / util / dtypes.c
index 8e60c20..b93fc9b 100644 (file)
@@ -56,6 +56,8 @@ static int basic_only = 0;
    has been received.
  */
 
+#define STR_SIZE 200
+
 /*
    Add a predefined MPI type to the tests.  _count instances of the
    type will be sent.
@@ -84,9 +86,9 @@ static int basic_only = 0;
   outbufs[cnt] = (void *)malloc(sizeof(_ctype) * (_count));    \
   a = (_ctype *)inbufs[cnt]; for (i=0; i<(_count); i++) a[i] = i;      \
   a = (_ctype *)outbufs[cnt]; for (i=0; i<(_count); i++) a[i] = 0;     \
-  myname = (char *)malloc(100);\
+  myname = (char *)malloc(STR_SIZE);\
   MPI_Type_get_name(_mpitype, _basename, &_basenamelen); \
-  snprintf(myname, 100, "Contig type %s", _basename);  \
+  snprintf(myname, STR_SIZE, "Contig type %s", _basename);     \
   MPI_Type_set_name(types[cnt], myname); \
   free(myname); \
   counts[cnt]  = 1;  bytesize[cnt] = sizeof(_ctype) * (_count); cnt++; }
@@ -105,9 +107,9 @@ static int basic_only = 0;
   outbufs[cnt] = (void *)calloc(sizeof(_ctype) * (_count) * (_stride),1); \
   a = (_ctype *)inbufs[cnt]; for (i=0; i<(_count); i++) a[i*(_stride)] = i; \
   a = (_ctype *)outbufs[cnt]; for (i=0; i<(_count); i++) a[i*(_stride)] = 0; \
-  myname = (char *)malloc(100);\
+  myname = (char *)malloc(STR_SIZE);\
   MPI_Type_get_name(_mpitype, _basename, &_basenamelen); \
-  snprintf(myname, 100, "Vector type %s", _basename);          \
+  snprintf(myname, STR_SIZE, "Vector type %s", _basename);             \
   MPI_Type_set_name(types[cnt], myname); \
   free(myname); \
   counts[cnt]  = 1; bytesize[cnt] = sizeof(_ctype) * (_count) * (_stride) ;\
@@ -130,9 +132,9 @@ static int basic_only = 0;
   outbufs[cnt] = (void *)malloc(sizeof(_ctype) * (_count)); \
   a = (_ctype *)inbufs[cnt]; for (i=0; i<(_count); i++) a[i] = i; \
   a = (_ctype *)outbufs[cnt]; for (i=0; i<(_count); i++) a[i] = 0; \
-  myname = (char *)malloc(100);\
+  myname = (char *)malloc(STR_SIZE);\
   MPI_Type_get_name(_mpitype, _basename, &_basenamelen); \
-  snprintf(myname, 100, "Index type %s", _basename);           \
+  snprintf(myname, STR_SIZE, "Index type %s", _basename);              \
   MPI_Type_set_name(types[cnt], myname); \
   free(myname); \
   counts[cnt]  = 1;  bytesize[cnt] = sizeof(_ctype) * (_count); cnt++; }
@@ -159,8 +161,8 @@ static int basic_only = 0;
       a[i].a2 = i; }                                                   \
   a = (struct name *)outbufs[cnt]; for (i=0; i<(_count); i++) { a[i].a1 = 0; \
       a[i].a2 = 0; }                                                   \
-  myname = (char *)malloc(100);                                        \
-  snprintf(myname, 100, "Struct type %s", _tname);             \
+  myname = (char *)malloc(STR_SIZE);                                   \
+  snprintf(myname, STR_SIZE, "Struct type %s", _tname);                \
   MPI_Type_set_name(types[cnt], myname); \
   free(myname); \
   counts[cnt]  = (_count);  bytesize[cnt] = sizeof(struct name) * (_count);cnt++; }
@@ -180,9 +182,9 @@ static int basic_only = 0;
   outbufs[cnt] = (void *)calloc(sizeof(_ctype) * (_count) * (_stride),1);\
   a = (_ctype *)inbufs[cnt]; for (i=0; i<(_count); i++) a[i*(_stride)] = i;  \
   a = (_ctype *)outbufs[cnt]; for (i=0; i<(_count); i++) a[i*(_stride)] = 0; \
-  myname = (char *)malloc(100);                                        \
+  myname = (char *)malloc(STR_SIZE);                                   \
   MPI_Type_get_name(_mpitype, _basename, &_basenamelen); \
-  snprintf(myname, 100, "Struct (MPI_UB) type %s", _basename); \
+  snprintf(myname, STR_SIZE, "Struct (MPI_UB) type %s", _basename);    \
   MPI_Type_set_name(types[cnt], myname); \
   free(myname); \
   counts[cnt]  = (_count);  \