1313 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1414 * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
1515 * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
16+ * Copyright (c) 2015 Research Organization for Information Science
17+ * and Technology (RIST). All rights reserved.
1618 * $COPYRIGHT$
1719 *
1820 * Additional copyrights may follow
@@ -36,9 +38,7 @@ int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const
3638 OPAL_PTRDIFF_TYPE extent ;
3739
3840 if ( 0 == count ) {
39- * newType = ompi_datatype_create ( 0 );
40- ompi_datatype_add ( * newType , & ompi_mpi_datatype_null .dt , 0 , 0 , 0 );
41- return OMPI_SUCCESS ;
41+ return ompi_datatype_duplicate ( & ompi_mpi_datatype_null .dt , newType );
4242 }
4343
4444 disp = pDisp [0 ];
@@ -113,12 +113,13 @@ int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* p
113113
114114 ompi_datatype_type_extent ( oldType , & extent );
115115 if ( (count == 0 ) || (bLength == 0 ) ) {
116- * newType = ompi_datatype_create ( 1 );
117- if ( 0 == count )
118- ompi_datatype_add ( * newType , & ompi_mpi_datatype_null . dt , 0 , 0 , 0 );
119- else
116+ if ( 0 == count ) {
117+ return ompi_datatype_duplicate ( & ompi_mpi_datatype_null . dt , newType );
118+ } else {
119+ * newType = ompi_datatype_create ( 1 );
120120 ompi_datatype_add ( * newType , oldType , 0 , pDisp [0 ] * extent , extent );
121- return OMPI_SUCCESS ;
121+ return OMPI_SUCCESS ;
122+ }
122123 }
123124 pdt = ompi_datatype_create ( count * (2 + oldType -> super .desc .used ) );
124125 disp = pDisp [0 ];
0 commit comments