Changeset 446
- Timestamp:
- 03/30/06 00:24:33 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
nepenthes/trunk/nepenthes-core/include/Compatibility.hpp
r321 r446 12 12 #endif 13 13 14 #ifndef HAVE_STRNDUP 15 extern char *strndup(char *str,int size); 14 16 #endif 15 17 18 #endif 19 nepenthes/trunk/nepenthes-core/src/Compatibility.cpp
r321 r446 100 100 #endif 101 101 102 #ifndef HAVE_STRNDUP 103 #include <string.h> 104 #include <stdlib.h> 105 106 char *strndup(char *str,unsigned int size) 107 { 108 int len = strlen(str) > size ? size : strlen(str); 109 char *retval = (char *)malloc(len+1); 110 memset(retval,0,len+1); 111 memcpy(retval,str,len); 112 return retval; 113 } 114 #endif 115
