Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/include/Diderot/diderot.h
ViewVC logotype

Diff of /branches/pure-cfg/src/include/Diderot/diderot.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1471, Sat Aug 13 11:46:41 2011 UTC revision 1472, Fri Aug 19 01:54:43 2011 UTC
# Line 76  Line 76 
76  //! get the current time in seconds  //! get the current time in seconds
77  double GetTime ();  double GetTime ();
78    
79    //! Checked memory allocation
80    STATIC_INLINE void *CheckedAlloc (size_t szb)
81    {
82        void *p = malloc(szb);
83        if (p == 0) {
84            fprintf (stderr, "fatal error: unable to allocate %d bytes of memory\n", (int)szb);
85            exit (1);
86        }
87        return p;
88    }
89    
90    #define NEW(ty)         (ty *)CheckedAlloc(sizeof(ty))
91    #define NEWVEC(ty,n)    (ty *)CheckedAlloc(sizeof(ty) * (n))
92    #define NEWSTR(s)       strcpy((char *)CheckedAlloc(strlen(s)+1), s)
93    
94    
95  /********** scalar math functions **********/  /********** scalar math functions **********/
96    

Legend:
Removed from v.1471  
changed lines
  Added in v.1472

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0