Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file is part of Hubbub.
  3.  * Licensed under the MIT License,
  4.  *                http://www.opensource.org/licenses/mit-license.php
  5.  * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
  6.  */
  7.  
  8. #ifndef hubbub_utils_h_
  9. #define hubbub_utils_h_
  10.  
  11. #ifdef BUILD_TARGET_riscos
  12.   /* If we're building with Norcroft, then we need to haul in
  13.    * unixlib.h from TCPIPLibs for useful things like strncasecmp
  14.    */
  15.   #ifdef __CC_NORCROFT
  16.   #include <unixlib.h>
  17.   #endif
  18. #endif
  19.  
  20. #ifdef BUILD_TARGET_windows
  21.   #define strncasecmp _strnicmp
  22. #endif
  23.  
  24. #ifndef max
  25. #define max(a,b) ((a)>(b)?(a):(b))
  26. #endif
  27.  
  28. #ifndef min
  29. #define min(a,b) ((a)<(b)?(a):(b))
  30. #endif
  31.  
  32. #ifndef SLEN
  33. /* Calculate length of a string constant */
  34. #define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */
  35. #endif
  36.  
  37. #ifndef UNUSED
  38. #define UNUSED(x) ((x)=(x))
  39. #endif
  40.  
  41. /* Useful for iterating over arrays */
  42. #define N_ELEMENTS(x)   sizeof((x)) / sizeof((x)[0])
  43.  
  44. #endif
  45.