diff options
Diffstat (limited to 'src/microhttpd/mhd_compat.c')
-rw-r--r-- | src/microhttpd/mhd_compat.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/microhttpd/mhd_compat.c b/src/microhttpd/mhd_compat.c index 6f6c6f9c..fd8132ac 100644 --- a/src/microhttpd/mhd_compat.c +++ b/src/microhttpd/mhd_compat.c | |||
@@ -79,6 +79,7 @@ W32_snprintf (char *__restrict s, | |||
79 | return ret; | 79 | return ret; |
80 | } | 80 | } |
81 | 81 | ||
82 | |||
82 | #endif /* HAVE_SNPRINTF */ | 83 | #endif /* HAVE_SNPRINTF */ |
83 | #endif /* _WIN32 && !__CYGWIN__ */ | 84 | #endif /* _WIN32 && !__CYGWIN__ */ |
84 | 85 | ||
@@ -93,16 +94,17 @@ W32_snprintf (char *__restrict s, | |||
93 | #endif /* __GNUC__ >= 5 */ | 94 | #endif /* __GNUC__ >= 5 */ |
94 | 95 | ||
95 | 96 | ||
96 | void *MHD_calloc_ (size_t nelem, size_t elsize) | 97 | void * |
98 | MHD_calloc_ (size_t nelem, size_t elsize) | ||
97 | { | 99 | { |
98 | size_t alloc_size; | 100 | size_t alloc_size; |
99 | void *ptr; | 101 | void *ptr; |
100 | #ifdef MHD_HAVE_NUL_OVERFLOW | 102 | #ifdef MHD_HAVE_NUL_OVERFLOW |
101 | if (__builtin_mul_overflow (nelem, elsize, &alloc_size) ||(0 == alloc_size)) | 103 | if (__builtin_mul_overflow (nelem, elsize, &alloc_size) || (0 == alloc_size)) |
102 | return NULL; | 104 | return NULL; |
103 | #else /* ! MHD_HAVE_NUL_OVERFLOW */ | 105 | #else /* ! MHD_HAVE_NUL_OVERFLOW */ |
104 | alloc_size = nelem * elsize; | 106 | alloc_size = nelem * elsize; |
105 | if ((0 == alloc_size)||(elsize != alloc_size / nelem)) | 107 | if ((0 == alloc_size) || (elsize != alloc_size / nelem)) |
106 | return NULL; | 108 | return NULL; |
107 | #endif /* ! MHD_HAVE_NUL_OVERFLOW */ | 109 | #endif /* ! MHD_HAVE_NUL_OVERFLOW */ |
108 | ptr = malloc (alloc_size); | 110 | ptr = malloc (alloc_size); |
@@ -111,4 +113,6 @@ void *MHD_calloc_ (size_t nelem, size_t elsize) | |||
111 | memset (ptr, 0, alloc_size); | 113 | memset (ptr, 0, alloc_size); |
112 | return ptr; | 114 | return ptr; |
113 | } | 115 | } |
116 | |||
117 | |||
114 | #endif /* ! HAVE_CALLOC */ | 118 | #endif /* ! HAVE_CALLOC */ |