diff options
author | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-08-17 05:01:20 +0400 |
---|---|---|
committer | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2006-08-17 05:01:20 +0400 |
commit | 55d63ca63f5d0d9d428ecc321393095733a782ef (patch) | |
tree | 14306901cdd8c956189bcbcf3de2b8f9ec0b3c59 /moses | |
parent | cdde0a6e11a65e15c9067de3af9fd3193a13097c (diff) |
visual studio issues
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@774 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses')
-rw-r--r-- | moses/src/Util.cpp | 19 | ||||
-rw-r--r-- | moses/src/Util.h | 19 |
2 files changed, 6 insertions, 32 deletions
diff --git a/moses/src/Util.cpp b/moses/src/Util.cpp index 42df7956e..8e8758825 100644 --- a/moses/src/Util.cpp +++ b/moses/src/Util.cpp @@ -107,23 +107,6 @@ bool Scan<bool>(const std::string &input) return (lc == "yes" || lc == "y" || lc == "true" || lc == "1"); } -#undef malloc -#undef realloc - -void* xmalloc(unsigned int numBytes) -{ - char* ptr = (char*)malloc(numBytes); - if(ptr == NULL) std::cout << "[FYI] xmalloc(): malloc returns null on request for " << numBytes << " bytes" << endl; - return ptr; -} - -void* xrealloc(void* ptr, unsigned int numBytes) -{ - char* rptr = (char*)realloc(ptr, numBytes); - if(rptr == NULL) std::cout << "[FYI] xrealloc(): realloc returns null on request for " << numBytes << " bytes" << endl; - return rptr; -} - #ifndef WIN32 void ResetUserTime() { @@ -134,7 +117,7 @@ void ResetUserTime() std::cerr << "ResetUserTime: failure in getrusage!\n"; }; -void PrintUserTime(std::ostream &out, std::string message){ +void PrintUserTime(std::ostream &out, const std::string &message){ struct rusage ru; if (getrusage(RUSAGE_SELF, &ru)!=-1) out << message.c_str() << " part(sec)=" << (unsigned long)ru.ru_utime.tv_sec - _util_usertime_sec diff --git a/moses/src/Util.h b/moses/src/Util.h index ab1b10734..f5e80ad08 100644 --- a/moses/src/Util.h +++ b/moses/src/Util.h @@ -236,19 +236,10 @@ template<typename T> inline void ShrinkToFit(T& v) { //A couple of utilities to measure decoding time -#ifndef WIN32 - +#ifdef WIN32 +inline void ResetUserTime() {} +inline void PrintUserTime(std::ostream &out, const std::string &message="") {} +#else void ResetUserTime(); -void PrintUserTime(std::ostream &out,std::string message=""); - +void PrintUserTime(std::ostream &out, const std::string &message=""); #endif - -/*** - * include checks for null return value, and helpful print statements - */ - /* -void* xmalloc(unsigned int numBytes); -void* xrealloc(void* ptr, unsigned int numBytes); -#define malloc(x) xmalloc(x) -#define realloc(x, n) xrealloc(x, n) -*/ |