home *** CD-ROM | disk | FTP | other *** search
/ ftp.ncftp.com / ftp.ncftp.com.zip / ftp.ncftp.com / libncftp / libncftp-3.2.5-src.zip / libncftp-3.2.5 / Strn / DStrInternal.h < prev    next >
C/C++ Source or Header  |  2001-11-16  |  750b  |  36 lines

  1. /* DStrInternal.h */
  2.  
  3. #ifndef _DStrInternal_h_
  4. #define _DStrInternal_h_ 1
  5.  
  6. #ifdef __cplusplus
  7. extern "C"
  8. {
  9. #endif    /* __cplusplus */
  10.  
  11. typedef struct DStr {
  12.     char *s;
  13.     size_t len;
  14.     size_t allocSize;
  15. } DStr, *DStrPtr;
  16.  
  17.  
  18. #ifdef __cplusplus
  19. }
  20. #endif    /* __cplusplus */
  21.  
  22. /* These checks should catch most cases where an
  23.  * uninitialized or trashed DStr structure has
  24.  * been passed in.  As a consequence, it limits
  25.  * our strings to a maximum length of 16777215.
  26.  *
  27.  * The assumptions are that malloc never
  28.  * returns an unaligned pointer, and that our
  29.  * allocation sizes are always multiples of 16
  30.  * bytes.
  31.  */
  32. #define IS_DSTR_CORRUPT(dst) \
  33.     ((((long) dst->s & 1) != 0) || ((dst->allocSize & 0xFF00000F) != 0) || ((dst->len & 0xFF000000) != 0))
  34.  
  35. #endif
  36.