Browse Source

Use _aligned_free for MinGW

pull/2274/head
Max Lv 5 years ago
parent
commit
fbb311ed06
2 changed files with 12 additions and 6 deletions
  1. 11
      src/utils.c
  2. 7
      src/utils.h

11
src/utils.c

@ -263,6 +263,17 @@ ss_align(size_t size)
}
}
void
ss_free(void *ptr)
{
#ifdef __MINGW32__
_aligned_free(ptr);
#else
free(ptr);
#endif
ptr = NULL;
}
void *
ss_realloc(void *ptr, size_t new_size)
{

7
src/utils.h

@ -229,15 +229,10 @@ int set_nofile(int nofile);
void *ss_malloc(size_t size);
void *ss_align(size_t size);
void *ss_realloc(void *ptr, size_t new_size);
void ss_free(void *ptr);
int ss_is_ipv6addr(const char *addr);
#define ss_free(ptr) \
do { \
free(ptr); \
ptr = NULL; \
} while (0)
char *get_default_conf(void);
#endif // _UTILS_H
Loading…
Cancel
Save