Changeset 21048

Show
Ignore:
Timestamp:
02/23/08 10:45:33 (8 months ago)
Author:
patrick
Message:

Use the C++ wrapper headers for standard C headers. Wherever possible, use
standard C functions from the std namespace. This is based on a patch
submitted by Doug McCorkle?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/vapor/vpr/Thread/Signal.h

    r20974 r21048  
    3939#include <vpr/vprConfig.h> 
    4040 
    41 #include <stdlib.h
    42 #include <string.h
     41#include <cstdlib
     42#include <cstring
    4343 
    4444#ifdef HAVE_SIGNAL_H 
     
    243243             const int flags) 
    244244   { 
    245       memset(&mSA, '\0', sizeof(mSA)); 
     245      std::memset(&mSA, '\0', sizeof(mSA)); 
    246246      mSA.sa_handler = handler; 
    247247      mSA.sa_flags   = flags; 
     
    249249      if ( mask != NULL ) 
    250250      { 
    251          memcpy(&mSA.sa_mask, mask, sizeof(sigset_t)); 
     251         std::memcpy(&mSA.sa_mask, mask, sizeof(sigset_t)); 
    252252      } 
    253253   } 
  • juggler/trunk/modules/vapor/vpr/Util/Assert.h

    r20974 r21048  
    4545 */ 
    4646#ifdef VPR_DEBUG 
    47 #   include <assert.h
     47#   include <cassert
    4848#   include <iostream> 
    4949#   include <vpr/SystemBase.h> 
  • juggler/trunk/modules/vapor/vpr/Util/Singleton.h

    r20974 r21048  
    3939#include <vpr/vprConfig.h> 
    4040 
    41 #include <stdlib.h
     41#include <cstdlib
    4242 
    4343#include <vpr/Sync/Mutex.h> 
  • juggler/trunk/modules/vapor/vpr/md/NSPR/Sync/MutexNSPR.h

    r20974 r21048  
    4646#include <vpr/vprConfig.h> 
    4747 
    48 #include <stdlib.h
     48#include <cstdlib
    4949#include <prlock.h> 
    5050#include <boost/noncopyable.hpp> 
  • juggler/trunk/modules/vapor/vpr/md/POSIX/Sync/CondVarPosix.h

    r20974 r21048  
    4646#include <vpr/vprConfig.h> 
    4747 
    48 #include <stdlib.h
    49 #include <assert.h
     48#include <cstdlib
     49#include <cassert
    5050#include <pthread.h> 
    5151#include <boost/noncopyable.hpp> 
  • juggler/trunk/modules/vapor/vpr/md/POSIX/SystemPosix.cpp

    r21035 r21048  
    3636#include <vpr/vprConfig.h> 
    3737 
    38 #include <stdlib.h
    39 #include <string.h
     38#include <cstdlib
     39#include <cstring
    4040#include <sys/utsname.h> 
    4141 
     
    118118   bool status(false); 
    119119 
    120    val = ::getenv(name.c_str()); 
     120   val = std::getenv(name.c_str()); 
    121121 
    122122   if ( val != NULL ) 
     
    150150   { 
    151151      char* temp; 
    152       temp = strchr(buffer.nodename, '.'); 
     152      temp = std::strchr(buffer.nodename, '.'); 
    153153 
    154154      // If the node name contains the full host, dots and all, truncate it 
  • juggler/trunk/modules/vapor/vpr/md/POSIX/Thread/ThreadPosix.h

    r20992 r21048  
    4545#include <vpr/vprConfig.h> 
    4646 
    47 #include <stdlib.h
     47#include <cstdlib
    4848#include <vector> 
    4949#include <pthread.h> 
  • juggler/trunk/modules/vapor/vpr/md/SIM/IO/Socket/SocketImplSIM.cpp

    r20974 r21048  
    3737 
    3838#include <iomanip> 
    39 #include <stdlib.h
    40 #include <string.h
     39#include <cstdlib
     40#include <cstring
    4141 
    4242#include <vpr/Util/Assert.h> 
     
    231231 
    232232         // Complete the read operation. 
    233          memcpy(buffer, message->getBody(), copy_len); 
     233         std::memcpy(buffer, message->getBody(), copy_len); 
    234234         bytes_read = copy_len; 
    235235 
  • juggler/trunk/modules/vapor/vpr/md/SIM/IO/Socket/SocketImplSIM.h

    r20974 r21048  
    3939#include <vpr/vprConfig.h> 
    4040 
    41 #include <stdlib.h
     41#include <cstdlib
    4242#include <string> 
    4343#include <vector> 
  • juggler/trunk/modules/vapor/vpr/md/SIM/Network/Message.h

    r20974 r21048  
    4242#include <boost/smart_ptr.hpp> 
    4343 
    44 #include <stdlib.h
    45 #include <string.h
     44#include <cstdlib
     45//#include <cstring
    4646#include <vpr/vpr.h> 
    4747#include <vpr/Util/Interval.h> 
     
    8181      vpr::Uint8* start = (vpr::Uint8*) msg; 
    8282      mMsg = MessageDataPtr( new MessageDataType(start, start+msg_size)); 
    83       //mMsg = malloc(msg_size); 
    84       //memcpy(mMsg, msg, msg_size); 
     83      //mMsg = std::malloc(msg_size); 
     84      //std::memcpy(mMsg, msg, msg_size); 
    8585   } 
    8686 
  • juggler/trunk/modules/vapor/vpr/md/SIM/Network/NetworkLine.h

    r20974 r21048  
    3939#include <vpr/vprConfig.h> 
    4040 
    41 #include <stdlib.h
    42 #include <math.h> 
     41#include <cstdlib
     42#include <cmath> 
    4343#include <string> 
    4444#include <deque> 
     
    152152 
    153153      // Round up since vpr::Interval objects deal in whole numbers. 
    154       double time = ceil(microsec); 
     154      double time = std::ceil(microsec); 
    155155 
    156156      return vpr::Interval((vpr::Uint32) time, vpr::Interval::Usec); 
  • juggler/trunk/modules/vapor/vpr/md/SIM/Network/NetworkNode.cpp

    r20974 r21048  
    3636#include <vpr/vprConfig.h> 
    3737 
    38 #include <stdlib.h
     38#include <cstdlib
    3939#include <vpr/Util/Assert.h> 
    4040#include <vpr/Util/Debug.h> 
     
    7575      cur_val  = ip_str.substr(cur_pos, next_dot - cur_pos); 
    7676 
    77       ip_addr.bytes[i] = atoi(cur_val.c_str()); 
     77      ip_addr.bytes[i] = std::atoi(cur_val.c_str()); 
    7878 
    7979      cur_pos = next_dot + 1; 
     
    134134   vprASSERT( mIpAddr == sock->getLocalAddr().getAddressValue() && "Trying to add socket to node of wrong ip addr"); 
    135135   if(hasSocket(port, sock->getType())) 
     136   { 
    136137      vprDEBUG(vprDBG_ALL, vprDBG_CRITICAL_LVL) << "NetworkNode::addSocket: Tried to overwrite existing socket: " << sock->getLocalAddr() << std::endl << vprDEBUG_FLUSH; 
     138   } 
    137139   vprASSERT(! hasSocket(port, sock->getType()) && "Tried to overwrite an existing socket"); 
    138140 
  • juggler/trunk/modules/vapor/vpr/md/SIM/SocketManager.cpp

    r20974 r21048  
    3636#include <vpr/vprConfig.h> 
    3737 
    38 #include <stdlib.h
     38#include <cstdlib
    3939#include <boost/concept_check.hpp> 
    4040#include <boost/utility.hpp> 
  • juggler/trunk/modules/vapor/vpr/md/WIN32/IO/Port/SerialPortImplWin32.cpp

    r20995 r21048  
    3838#include <iostream> 
    3939#include <sstream> 
    40 #include <stdlib.h> 
    41 #include <string.h> 
     40#include <cstdlib> 
    4241 
    4342#include <vpr/IO/TimeoutException.h>