1 /* -*- Mode: C; c-basic-offset:4 ; -*- */ 2 /* 3 * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana 4 * University Research and Technology 5 * Corporation. All rights reserved. 6 * Copyright (c) 2004-2009 The University of Tennessee and The University 7 * of Tennessee Research Foundation. All rights 8 * reserved. 9 * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, 10 * University of Stuttgart. All rights reserved. 11 * Copyright (c) 2004-2006 The Regents of the University of California. 12 * All rights reserved. 13 * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. 14 * $COPYRIGHT$ 15 * 16 * Additional copyrights may follow 17 * 18 * $HEADER$ 19 */ 20 21 #include "opal_config.h" 22 #include "opal/constants.h" 23 #include "opal/datatype/opal_datatype.h" 24 #include "opal/datatype/opal_datatype_internal.h" 25 26 int32_t opal_datatype_destroy( opal_datatype_t** dt ) 27 { 28 opal_datatype_t* pData = *dt; 29 30 if( (pData->flags & OPAL_DATATYPE_FLAG_PREDEFINED) && 31 (pData->super.obj_reference_count <= 1) ) 32 return OPAL_ERROR; 33 34 OBJ_RELEASE( pData ); 35 *dt = NULL; 36 return OPAL_SUCCESS; 37 }