root/ompi/mpi/c/info_delete.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_Info_delete

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2013      Los Alamos National Security, LLC.  All rights
  14  *                         reserved.
  15  * Copyright (c) 2015      Research Organization for Information Science
  16  *                         and Technology (RIST). All rights reserved.
  17  * Copyright (c) 2017      Cisco Systems, Inc.  All rights reserved
  18  * $COPYRIGHT$
  19  *
  20  * Additional copyrights may follow
  21  *
  22  * $HEADER$
  23  */
  24 
  25 #include "ompi_config.h"
  26 
  27 #include "ompi/mpi/c/bindings.h"
  28 #include "ompi/runtime/params.h"
  29 #include "ompi/communicator/communicator.h"
  30 #include "ompi/errhandler/errhandler.h"
  31 #include "ompi/info/info.h"
  32 #include <stdlib.h>
  33 #include <string.h>
  34 
  35 #if OMPI_BUILD_MPI_PROFILING
  36 #if OPAL_HAVE_WEAK_SYMBOLS
  37 #pragma weak MPI_Info_delete = PMPI_Info_delete
  38 #endif
  39 #define MPI_Info_delete PMPI_Info_delete
  40 #endif
  41 
  42 static const char FUNC_NAME[] = "MPI_Info_delete";
  43 
  44 
  45 /**
  46  * Delete a (key,value) pair from "info"
  47  *
  48  * @param info MPI_Info handle on which we need to operate
  49  * @param key The key portion of the (key,value) pair that
  50  *            needs to be deleted
  51  *
  52  * @retval MPI_SUCCESS If the (key,val) pair was deleted
  53  * @retval MPI_ERR_INFO
  54  * @retval MPI_ERR_INFO_KEYY
  55  */
  56 int MPI_Info_delete(MPI_Info info, const char *key) {
  57     int key_length;
  58     int err;
  59 
  60     /**
  61      * This function merely deletes the (key,val) pair in info
  62      */
  63     if (MPI_PARAM_CHECK) {
  64         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  65         if (NULL == info || MPI_INFO_NULL == info ||
  66             ompi_info_is_freed(info)) {
  67             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INFO,
  68                                           FUNC_NAME);
  69         }
  70 
  71         key_length = (key) ? (int)strlen (key) : 0;
  72         if ((NULL == key) || (0 == key_length) ||
  73             (MPI_MAX_INFO_KEY <= key_length)) {
  74           return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INFO_KEY,
  75                                         FUNC_NAME);
  76         }
  77     }
  78 
  79     OPAL_CR_ENTER_LIBRARY();
  80 
  81     err = ompi_info_delete (info, key);
  82 
  83     // Note that ompi_info_delete() (i.e., opal_info_delete()) will
  84     // return OPAL_ERR_NOT_FOUND if there was no corresponding key to
  85     // delete.  Per MPI-3.1, we need to convert that to
  86     // MPI_ERR_INFO_NOKEY.
  87     if (OPAL_ERR_NOT_FOUND == err) {
  88         err = MPI_ERR_INFO_NOKEY;
  89     }
  90 
  91     OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME);
  92 }

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