00001
00002
00003
00004
00005
00006
00007
00008 #include "mpioimpl.h"
00009
00010 #ifdef HAVE_WEAK_SYMBOLS
00011
00012 #if defined(HAVE_PRAGMA_WEAK)
00013 #pragma weak MPI_Info_dup = PMPI_Info_dup
00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00015 #pragma _HP_SECONDARY_DEF PMPI_Info_dup MPI_Info_dup
00016 #elif defined(HAVE_PRAGMA_CRI_DUP)
00017 #pragma _CRI duplicate MPI_Info_dup as PMPI_Info_dup
00018
00019 #endif
00020
00021
00022 #define MPIO_BUILD_PROFILING
00023 #include "mpioprof.h"
00024 #endif
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo)
00038 {
00039 MPI_Info curr_old, curr_new;
00040
00041 if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) {
00042 FPRINTF(stderr, "MPI_Info_dup: Invalid info object\n");
00043 MPI_Abort(MPI_COMM_WORLD, 1);
00044 }
00045
00046 *newinfo = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info));
00047 curr_new = *newinfo;
00048 curr_new->cookie = MPIR_INFO_COOKIE;
00049 curr_new->key = 0;
00050 curr_new->value = 0;
00051 curr_new->next = 0;
00052
00053 curr_old = info->next;
00054 while (curr_old) {
00055 curr_new->next = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info));
00056 curr_new = curr_new->next;
00057 curr_new->cookie = 0;
00058 curr_new->key = ADIOI_Strdup(curr_old->key);
00059 curr_new->value = ADIOI_Strdup(curr_old->value);
00060 curr_new->next = 0;
00061
00062 curr_old = curr_old->next;
00063 }
00064
00065 return MPI_SUCCESS;
00066 }