The  named  buffer  pool,  previously  initialised  by  a  call on
    bpool(), is validated for bad pointers, overwritten data, etc.  If
    compiled with NDEBUG not defined, any error generates an assertion
    failure.  Otherwise 1 is returned if the pool is valid,  0  if  an
    error is found.
    BGET CONFIGURATION
    ==================
*/
//#define PIO_USE_MALLOC 1
#ifdef PIO_USE_MALLOC
#include <stdlib.h>
#endif
#define TestProg    20000         /* Generate built-in test program
                     if defined.  The value specifies
                     how many buffer allocation attempts
                     the test program should make. */
#undef TestProg
    struct bfhead *b;
#ifdef BestFit
    struct bfhead *best;
#endif
    void *buf;
#ifdef BECtl
    int compactseq = 0;
#endif
#ifdef PIO_USE_MALLOC
    if(requested_size>maxsize){
      maxsize=requested_size;
      printf("%s %d %d\n",__FILE__,__LINE__,maxsize);
    }
    return(malloc(requested_size));
    //    if(requested_size>maxsize){
    //   maxsize=requested_size;
    //   printf("%s %d %d\n",__FILE__,__LINE__,maxsize);
    // }
    buf = malloc(requested_size);
    //    printf("bget allocate %ld %x\n",requested_size,buf);
    return(buf);
#endif 
    if(size<=0)
      print_trace(NULL);
    assert(size > 0);
    if (size < SizeQ) {           /* Need at least room for the */
    size = SizeQ;             /*    queue links.  */
}
/*  BREL  --  Release a buffer.  */
void brel(buf)
  void *buf;
{
    struct bfhead *b, *bn;
#ifdef PIO_USE_MALLOC
    //    printf("bget free %d %x\n",__LINE__,buf);
    free(buf);
    return;
#endif    
    if(buf==NULL) return;       /* allow for null buffer */
    b = BFH(((char *) buf) - sizeof(struct bhead));
#ifdef BufStats
    numrel++;                 /* Increment number of brel() calls */