X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d5b29830df70e823202e384a7655e4371193ecd7..12a28e1db519ea909c66f6be10ceb308f1333d14:/teshsuite/smpi/macro-shared/macro-shared.c diff --git a/teshsuite/smpi/macro-shared/macro-shared.c b/teshsuite/smpi/macro-shared/macro-shared.c index 1e09ac43de..51da71b1d6 100644 --- a/teshsuite/smpi/macro-shared/macro-shared.c +++ b/teshsuite/smpi/macro-shared/macro-shared.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2015. The SimGrid Team. +/* Copyright (c) 2009-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -11,9 +11,9 @@ #include #include -static void* hash(char *str, uint64_t* ans) +static void* hash(const char *str, uint64_t* ans) { - char *tohash = str; + const char *tohash = str; *ans=5381; printf("hashing !\n"); int c = *tohash; @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) MPI_Barrier(MPI_COMM_WORLD); //Try SMPI_SHARED_CALL function, which should call hash only once and for all. - char *str = strdup("onceandforall"); + static const char str[] = "onceandforall"; if(rank==size-1){ SMPI_SHARED_CALL(hash,str,str,buf); } @@ -55,7 +55,6 @@ int main(int argc, char *argv[]) printf("[%d] After change, the value in the shared buffer is: %" PRIu64"\n", rank, *buf); SMPI_SHARED_FREE(buf); - free(str); MPI_Finalize(); return 0;