RCS_ID_C="$Id: allocdatabuffer.c,v 1.1 1993/06/12 22:57:18 too Exp $";
/*
 * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
 *                    Helsinki University of Technology, Finland.
 *                    All rights reserved.
 *
 * Created: Sun Jun 13 01:09:17 1993 too
 * Last modified: Sun Jun 13 01:36:24 1993 too
 *
 * HISTORY
 * $Log: allocdatabuffer.c,v $
 * Revision 1.1  1993/06/12  22:57:18  too
 * Initial revision
 *
 *
 */

#include <exec/types.h>

#include <sys/malloc.h>

#include <api/amiga_api.h>
#include <api/allocdatabuffer.h>

BOOL doAllocDataBuffer(struct DataBuffer * DB, int size)
{
  if (DB->db_Addr)
    bsd_free(DB->db_Addr, M_TEMP);
  if ((DB->db_Addr = bsd_malloc(size, M_TEMP, M_WAITOK)) == NULL) {
    DB->db_Size = 0;
    return FALSE;
  }
  DB->db_Size = size;
  return TRUE;
}

VOID freeDataBuffer(struct DataBuffer * DB)
{
  if (DB->db_Addr)
    bsd_free(DB->db_Addr, M_TEMP);
  DB->db_Size = 0;
  DB->db_Addr = NULL;
}

