misc/libopenalbridge/wrappers.c
changeset 3514 59dbd31e9953
parent 3513 f589230fa21b
child 3529 0e968ba12a84
equal deleted inserted replaced
3513:f589230fa21b 3514:59dbd31e9953
       
     1 /*
       
     2 * OpenAL Bridge - a simple portable library for OpenAL interface
       
     3 * Copyright (c) 2009 Vittorio Giovara <vittorio.giovara@gmail.com>
       
     4 *
       
     5 * This program is free software; you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation; version 2 of the License
       
     8 *
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program; if not, write to the Free Software
       
    16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    17 */
       
    18 
       
    19 #include "wrappers.h"
       
    20 #include "openalbridge_t.h"
       
    21 
       
    22 
       
    23 void *Malloc (size_t nbytes) {
       
    24     void *aptr;
       
    25 
       
    26     if ((aptr = malloc(nbytes)) == NULL) {
       
    27         fprintf(stderr,"(Bridge FATAL) - not enough memory\n");
       
    28         abort();
       
    29     }
       
    30 
       
    31     return aptr;
       
    32 }
       
    33 
       
    34 
       
    35 void *Realloc (void *aptr, size_t nbytes) {
       
    36     aptr = realloc(aptr, nbytes);
       
    37 
       
    38     if (aptr == NULL) {
       
    39         fprintf(stderr,"(Bridge FATAL) - not enough memory\n");
       
    40         abort();
       
    41     }
       
    42 
       
    43     return aptr;
       
    44 }
       
    45 
       
    46 
       
    47 FILE *Fopen (const char *fname, char *mode)	{
       
    48     FILE *fp;
       
    49 
       
    50     fp = fopen(fname,mode);
       
    51     if (fp == NULL)
       
    52         fprintf(stderr,"(Bridge Error) - can't open file %s in mode '%s'\n", fname, mode);
       
    53 
       
    54     return fp;
       
    55 }
       
    56 
       
    57