SCM Repository
Annotation of /examples/util/util.c
Parent Directory
|
Revision Log
Revision 3349 - (view) (download) (as text)
1 : | jhr | 1884 | /*! \file util.c |
2 : | * | ||
3 : | * \brief This file contains various utility functions. | ||
4 : | * | ||
5 : | * \author John Reppy | ||
6 : | */ | ||
7 : | |||
8 : | /* | ||
9 : | jhr | 3349 | * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu) |
10 : | * | ||
11 : | * COPYRIGHT (c) 2015 The University of Chicago | ||
12 : | jhr | 1884 | * All rights reserved. |
13 : | */ | ||
14 : | |||
15 : | #include "util.h" | ||
16 : | #include <stdio.h> | ||
17 : | |||
18 : | /* CheckMalloc: | ||
19 : | */ | ||
20 : | void *CheckMalloc (size_t nbytes) | ||
21 : | { | ||
22 : | void *obj = malloc(nbytes); | ||
23 : | if (obj == 0) { | ||
24 : | fprintf(stderr, "Fatel error: unable to allocate %d bytes\n", (int)nbytes); | ||
25 : | exit (1); | ||
26 : | } | ||
27 : | |||
28 : | return obj; | ||
29 : | } |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |