HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition");
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the files COPYING and Copyright.html.  COPYING can be found at the root   *
 * of the source code distribution tree; Copyright.html can be found at the  *
 * root level of an installed copy of the electronic HDF5 document set and   *
 * is linked from the top-level documents page.  It can also be found at     *
 * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
 * access to either file, you may request a copy from help@hdfgroup.org.     *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
 * Purpose: Provides a heap abstract data type.
 *
 *              (See chapter 11 - "Priority Queues" of _Algorithms_, by
 *              Sedgewick for additional information)
 *
 */
/* Private headers needed */
#include "H5private.h"      /* Generic Functions            */
#include "H5Eprivate.h"     /* Error handling           */
#include "H5HPprivate.h"    /* Heap routines            */
#include "H5FLprivate.h"    /* Memory management functions      */
/* Local Macros */
#define H5HP_START_SIZE 16      /* Initial number of entries for heaps */
/* Private typedefs & structs */
/* Data structure for entries in the internal heap array */
typedef struct {
    int val;            /* Value to be used for heap condition */
    H5HP_info_t *obj;   /* Pointer to object stored in heap */
}H5HP_ent_t;
/* Main heap data structure */
struct H5HP_t {
    H5HP_type_t type;   /* Type of heap (minimum or maximum value at "top") */
    size_t nobjs;       /* Number of active objects in heap array */
    size_t nalloc;      /* Number of allocated locations in heap array */
    H5HP_ent_t *heap;   /* Pointer to array containing heap entries */
};
/* Static functions */
static herr_t H5HP_swim_max(H5HP_t *heap, size_t loc);