Browse Source

only define LTC_NO_PROTOTYPES on one point

This closes #132
Steffen Jaeckel 8 years ago
parent
commit
76b289833c
1 changed files with 6 additions and 27 deletions
  1. 6 27
      src/headers/tomcrypt_custom.h

+ 6 - 27
src/headers/tomcrypt_custom.h

@@ -3,55 +3,31 @@
 
 
 /* macros for various libc functions you can change for embedded targets */
 /* macros for various libc functions you can change for embedded targets */
 #ifndef XMALLOC
 #ifndef XMALLOC
-   #ifdef malloc
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XMALLOC  malloc
 #define XMALLOC  malloc
 #endif
 #endif
 #ifndef XREALLOC
 #ifndef XREALLOC
-   #ifdef realloc
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XREALLOC realloc
 #define XREALLOC realloc
 #endif
 #endif
 #ifndef XCALLOC
 #ifndef XCALLOC
-   #ifdef calloc
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XCALLOC  calloc
 #define XCALLOC  calloc
 #endif
 #endif
 #ifndef XFREE
 #ifndef XFREE
-   #ifdef free
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XFREE    free
 #define XFREE    free
 #endif
 #endif
 
 
 #ifndef XMEMSET
 #ifndef XMEMSET
-   #ifdef memset
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XMEMSET  memset
 #define XMEMSET  memset
 #endif
 #endif
 #ifndef XMEMCPY
 #ifndef XMEMCPY
-   #ifdef memcpy
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XMEMCPY  memcpy
 #define XMEMCPY  memcpy
 #endif
 #endif
 #ifndef XMEMCMP
 #ifndef XMEMCMP
-   #ifdef memcmp
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XMEMCMP  memcmp
 #define XMEMCMP  memcmp
 #endif
 #endif
 #ifndef XMEM_NEQ
 #ifndef XMEM_NEQ
 #define XMEM_NEQ  mem_neq
 #define XMEM_NEQ  mem_neq
 #endif
 #endif
 #ifndef XSTRCMP
 #ifndef XSTRCMP
-   #ifdef strcmp
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XSTRCMP strcmp
 #define XSTRCMP strcmp
 #endif
 #endif
 
 
@@ -63,12 +39,15 @@
 #endif
 #endif
 
 
 #ifndef XQSORT
 #ifndef XQSORT
-   #ifdef qsort
-   #define LTC_NO_PROTOTYPES
-   #endif
 #define XQSORT qsort
 #define XQSORT qsort
 #endif
 #endif
 
 
+#if defined(malloc) || defined(realloc) || defined(calloc) || defined(free) || \
+      defined(memset) || defined(memcpy) || defined(memcmp) || defined(strcmp) || \
+      defined(clock) || defined(qsort)
+#define LTC_NO_PROTOTYPES
+#endif
+
 /* shortcut to disable automatic inclusion */
 /* shortcut to disable automatic inclusion */
 #if defined LTC_NOTHING && !defined LTC_EASY
 #if defined LTC_NOTHING && !defined LTC_EASY
   #define LTC_NO_MATH
   #define LTC_NO_MATH