"Fossies" - the Fresh Open Source Software Archive

Member "portfwd-0.29/src/util.hpp" (15 May 2001, 393 Bytes) of package /linux/privat/old/portfwd-0.29.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // util.hpp
    2 //
    3 // $Id: util.hpp,v 1.1.1.1 2001/05/15 00:25:01 evertonm Exp $
    4 
    5 
    6 #ifndef UTIL_HPP
    7 #define UTIL_HPP
    8 
    9 
   10 #include "util.h"
   11 
   12 
   13 template <class T> 
   14 T* safe_new(T* sample, int size)
   15 {
   16   sample = new T[size];
   17   if (!sample) {
   18     syslog(LOG_EMERG, "%s:%s (%d x %d)\n", "safe_new()", "could not allocate array", size, sizeof(T));
   19     exit(1);
   20   }
   21 
   22   return sample;
   23 }
   24 
   25 
   26 #endif  // UTIL_HPP