config.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * "$Id: config.h 451 2014-01-04 21:50:06Z msweet $"
  3. *
  4. * Configuration file for Mini-XML, a small XML-like file parsing library.
  5. *
  6. * Copyright 2003-2014 by Michael R Sweet.
  7. *
  8. * These coded instructions, statements, and computer programs are the
  9. * property of Michael R Sweet and are protected by Federal copyright
  10. * law. Distribution and use rights are outlined in the file "COPYING"
  11. * which should have been included with this file. If this file is
  12. * missing or damaged, see the license at:
  13. *
  14. * http://www.msweet.org/projects.php/Mini-XML
  15. */
  16. /*
  17. * Beginning with VC2005, Microsoft breaks ISO C and POSIX conformance
  18. * by deprecating a number of functions in the name of security, even
  19. * when many of the affected functions are otherwise completely secure.
  20. * The _CRT_SECURE_NO_DEPRECATE definition ensures that we won't get
  21. * warnings from their use...
  22. *
  23. * Then Microsoft decided that they should ignore this in VC2008 and use
  24. * yet another define (_CRT_SECURE_NO_WARNINGS) instead. Bastards.
  25. */
  26. #define _CRT_SECURE_NO_DEPRECATE
  27. #define _CRT_SECURE_NO_WARNINGS
  28. /*
  29. * Include necessary headers...
  30. */
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34. #include <stdarg.h>
  35. #include <ctype.h>
  36. #include <io.h>
  37. /*
  38. * Microsoft also renames the POSIX functions to _name, and introduces
  39. * a broken compatibility layer using the original names. As a result,
  40. * random crashes can occur when, for example, strdup() allocates memory
  41. * from a different heap than used by malloc() and free().
  42. *
  43. * To avoid moronic problems like this, we #define the POSIX function
  44. * names to the corresponding non-standard Microsoft names.
  45. */
  46. #define close _close
  47. #define open _open
  48. #define read _read
  49. #define snprintf _snprintf
  50. #define strdup _strdup
  51. #define vsnprintf _vsnprintf
  52. #define write _write
  53. /*
  54. * Version number...
  55. */
  56. #define MXML_VERSION "Mini-XML v2.8"
  57. /*
  58. * Inline function support...
  59. */
  60. #define inline _inline
  61. /*
  62. * Long long support...
  63. */
  64. #define HAVE_LONG_LONG 1
  65. /*
  66. * Do we have the snprintf() and vsnprintf() functions?
  67. */
  68. #define HAVE_SNPRINTF 1
  69. #define HAVE_VSNPRINTF 1
  70. /*
  71. * Do we have the strXXX() functions?
  72. */
  73. #define HAVE_STRDUP 1
  74. /*
  75. * Define prototypes for string functions as needed...
  76. */
  77. # ifndef HAVE_STRDUP
  78. extern char *_mxml_strdup(const char *);
  79. # define strdup _mxml_strdup
  80. # endif /* !HAVE_STRDUP */
  81. extern char *_mxml_strdupf(const char *, ...);
  82. extern char *_mxml_vstrdupf(const char *, va_list);
  83. # ifndef HAVE_SNPRINTF
  84. extern int _mxml_snprintf(char *, size_t, const char *, ...);
  85. # define snprintf _mxml_snprintf
  86. # endif /* !HAVE_SNPRINTF */
  87. # ifndef HAVE_VSNPRINTF
  88. extern int _mxml_vsnprintf(char *, size_t, const char *, va_list);
  89. # define vsnprintf _mxml_vsnprintf
  90. # endif /* !HAVE_VSNPRINTF */
  91. /*
  92. * End of "$Id: config.h 451 2014-01-04 21:50:06Z msweet $".
  93. */