root/ompi/mca/io/romio321/romio/mpi2-other/info/info_dup.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_Info_dup

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 1997 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "mpioimpl.h"
   9 
  10 #ifdef HAVE_WEAK_SYMBOLS
  11 
  12 #if defined(HAVE_PRAGMA_WEAK)
  13 #pragma weak MPI_Info_dup = PMPI_Info_dup
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_Info_dup MPI_Info_dup
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_Info_dup as PMPI_Info_dup
  18 /* end of weak pragmas */
  19 #endif
  20 
  21 /* Include mapping from MPI->PMPI */
  22 #define MPIO_BUILD_PROFILING
  23 #include "mpioprof.h"
  24 #endif
  25 
  26 /*@
  27     MPI_Info_dup - Returns a duplicate of the info object
  28 
  29 Input Parameters:
  30 . info - info object (handle)
  31 
  32 Output Parameters:
  33 . newinfo - duplicate of info object (handle)
  34 
  35 .N fortran
  36 @*/
  37 int MPI_Info_dup(MPI_Info info, MPI_Info *newinfo)
  38 {
  39     MPI_Info curr_old, curr_new;
  40 
  41     if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) {
  42         FPRINTF(stderr, "MPI_Info_dup: Invalid info object\n");
  43         MPI_Abort(MPI_COMM_WORLD, 1);
  44     }
  45 
  46     *newinfo = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info));
  47     curr_new = *newinfo;
  48     curr_new->cookie = MPIR_INFO_COOKIE;
  49     curr_new->key = 0;
  50     curr_new->value = 0;
  51     curr_new->next = 0;
  52 
  53     curr_old = info->next;
  54     while (curr_old) {
  55         curr_new->next = (MPI_Info) ADIOI_Malloc(sizeof(struct MPIR_Info));
  56         curr_new = curr_new->next;
  57         curr_new->cookie = 0;  /* cookie not set on purpose */
  58         curr_new->key = ADIOI_Strdup(curr_old->key);
  59         curr_new->value = ADIOI_Strdup(curr_old->value);
  60         curr_new->next = 0;
  61         
  62         curr_old = curr_old->next;
  63     }
  64 
  65     return MPI_SUCCESS;
  66 }

/* [<][>][^][v][top][bottom][index][help] */