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_get_valuelen = PMPI_Info_get_valuelen
00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00015 #pragma _HP_SECONDARY_DEF PMPI_Info_get_valuelen MPI_Info_get_valuelen
00016 #elif defined(HAVE_PRAGMA_CRI_DUP)
00017 #pragma _CRI duplicate MPI_Info_get_valuelen as PMPI_Info_get_valuelen
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 
00038 
00039 int MPI_Info_get_valuelen(MPI_Info info, char *key, int *valuelen, int *flag)
00040 {
00041     MPI_Info curr;
00042 
00043     if ((info <= (MPI_Info) 0) || (info->cookie != MPIR_INFO_COOKIE)) {
00044         FPRINTF(stderr, "MPI_Info_get_valuelen: Invalid info object\n");
00045         MPI_Abort(MPI_COMM_WORLD, 1);
00046     }
00047 
00048     if (key <= (char *) 0) {
00049     FPRINTF(stderr, "MPI_Info_get_valuelen: key is an invalid address\n");
00050         MPI_Abort(MPI_COMM_WORLD, 1);
00051     }
00052 
00053     if (strlen(key) > MPI_MAX_INFO_KEY) {
00054     FPRINTF(stderr, "MPI_Info_get_valuelen: key is longer than MPI_MAX_INFO_KEY\n");
00055         MPI_Abort(MPI_COMM_WORLD, 1);
00056     }
00057 
00058     if (!strlen(key)) {
00059     FPRINTF(stderr, "MPI_Info_get_valuelen: key is a null string\n");
00060         MPI_Abort(MPI_COMM_WORLD, 1);
00061     }
00062 
00063     curr = info->next;
00064     *flag = 0;
00065 
00066     while (curr) {
00067     if (!strcmp(curr->key, key)) {
00068         *valuelen = strlen(curr->value);
00069         *flag = 1;
00070         break;
00071     }
00072     curr = curr->next;
00073     }
00074 
00075     return MPI_SUCCESS;
00076 }