aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-07-23 18:55:09 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-07-23 18:55:09 +0000
commit43bb6196b0d76d04afca8dd478a47f38352b6e29 (patch)
tree19d5c9f9a016bdb94e96f0503e74a982f56af080 /src/include
parentabdd48c5f2ca74db2501a4e52245dfc8bd470710 (diff)
downloadlibmicrohttpd-43bb6196b0d76d04afca8dd478a47f38352b6e29.tar.gz
libmicrohttpd-43bb6196b0d76d04afca8dd478a47f38352b6e29.zip
Added MHD_FAVOR_FAST_CODE and MHD_FAVOR_SMALL_CODE automatic macros.
Macros can be forced by external define. Added versions of mhd_str functions for smaller resulting code.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/mhd_options.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h
index 3541c4b8..2e798ebf 100644
--- a/src/include/mhd_options.h
+++ b/src/include/mhd_options.h
@@ -93,4 +93,25 @@
93#define __STDC_WANT_LIB_EXT1__ 1 93#define __STDC_WANT_LIB_EXT1__ 1
94#endif /* HAVE_C11_GMTIME_S */ 94#endif /* HAVE_C11_GMTIME_S */
95 95
96#if defined(MHD_FAVOR_FAST_CODE) && defined(MHD_FAVOR_SMALL_CODE)
97#error MHD_FAVOR_FAST_CODE and MHD_FAVOR_SMALL_CODE are both defined. Cannot favor speed and size at the same time.
98#endif /* MHD_FAVOR_FAST_CODE && MHD_FAVOR_SMALL_CODE */
99
100/* Define MHD_FAVOR_FAST_CODE to force fast code path or
101 define MHD_FAVOR_SMALL_CODE to choose compact code path */
102#if !defined(MHD_FAVOR_FAST_CODE) && !defined(MHD_FAVOR_SMALL_CODE)
103/* Try to detect user preferences */
104/* Defined by GCC and many compatible compilers */
105#ifdef __OPTIMIZE_SIZE__
106#define MHD_FAVOR_SMALL_CODE 1
107#elif __OPTIMIZE__
108#define MHD_FAVOR_FAST_CODE 1
109#endif /* __OPTIMIZE__ */
110#endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */
111
112#if !defined(MHD_FAVOR_FAST_CODE) && !defined(MHD_FAVOR_SMALL_CODE)
113/* Use faster code by default */
114#define MHD_FAVOR_FAST_CODE 1
115#endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */
116
96#endif /* MHD_OPTIONS_H */ 117#endif /* MHD_OPTIONS_H */