Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

fmalloc.c File Reference

#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.


Functions

void fail_die_malloc_die (size_t size, const char *file, int line)
void * fail_die_malloc (size_t size, const char *file, int line)
void * fail_die_realloc (void *p, size_t size, const char *file, int line)

Function Documentation

void* fail_die_malloc size_t    size,
const char *    file,
int    line
 

Definition at line 20 of file fmalloc.c.

References fail_die_malloc_die(), file, malloc, and p.

Referenced by fail_die_realloc().

00021 {
00022   void *p = malloc(size);
00023   if (!p && size)
00024     fail_die_malloc_die(size, file, line);
00025   return p;
00026 }

void fail_die_malloc_die size_t    size,
const char *    file,
int    line
[static]
 

Definition at line 12 of file fmalloc.c.

References file.

Referenced by fail_die_malloc(), and fail_die_realloc().

00013 {
00014   fprintf(stderr, "Out of memory! (wanted %lu at %s:%d)\n",
00015           (unsigned long)size, file, line);
00016   exit(1);
00017 }

void* fail_die_realloc void *    p,
size_t    size,
const char *    file,
int    line
 

Definition at line 29 of file fmalloc.c.

References fail_die_malloc(), fail_die_malloc_die(), file, p, and realloc.

00030 {
00031   if (!p)
00032     return fail_die_malloc(size, file, line);
00033   p = realloc(p, size);
00034   if (!p && size)
00035     fail_die_malloc_die(size, file, line);
00036   return p;
00037 }
 

Powered by Plone

This site conforms to the following standards: