Changeset 446

Show
Ignore:
Timestamp:
03/30/06 00:24:33 (3 years ago)
Author:
common
Message:

Compatibilty
- add strndup, i really hope its availible in the modules ...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/nepenthes-core/include/Compatibility.hpp

    r321 r446  
    1212#endif 
    1313 
     14#ifndef HAVE_STRNDUP 
     15extern char *strndup(char *str,int size); 
    1416#endif  
    1517 
     18#endif  
     19 
  • nepenthes/trunk/nepenthes-core/src/Compatibility.cpp

    r321 r446  
    100100#endif 
    101101 
     102#ifndef HAVE_STRNDUP 
     103#include <string.h> 
     104#include <stdlib.h> 
     105 
     106char *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