HD downscalers, make variables beginning with numbers where little problematic!
[cinelerra_cv/mob.git] / toolame-02l / mem.c
blob216ec2b89ee320ae8f3591b03ece087c9e2d3cf4
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "common.h"
5 #include "mem.h"
7 /*******************************************************************************
9 * Allocate number of bytes of memory equal to "block".
11 *******************************************************************************/
13 void *mem_alloc (unsigned long block, char *item)
16 void *ptr;
18 ptr = (void *) malloc (block);
20 if (ptr != NULL) {
21 memset (ptr, 0, block);
22 } else {
23 fprintf (stderr, "Unable to allocate %s\n", item);
24 exit (0);
26 return (ptr);
30 /****************************************************************************
32 * Free memory pointed to by "*ptr_addr".
34 *****************************************************************************/
36 void mem_free (void **ptr_addr)
39 if (*ptr_addr != NULL) {
40 free (*ptr_addr);
41 *ptr_addr = NULL;