]> wimlib.net Git - wimlib/blobdiff - include/wimlib/util.h
bitops: use builtins directly
[wimlib] / include / wimlib / util.h
index 3dc59f454faae2099979af514a7a4994b052a345..6c9ee061efadd6c694bee17a066bad857ba4d7f6 100644 (file)
@@ -26,6 +26,7 @@
 
 /* Round 'v' up to the next 'alignment'-byte aligned boundary.  'alignment' must
  * be a power of 2.  */
+#undef ALIGN   /* NetBSD <sys/param.h> defines this already */
 #define ALIGN(v, alignment)    (((v) + ((alignment) - 1)) & ~((alignment) - 1))
 
 /* Maximum number of bytes that can be allocated on the stack.
  * Memory allocation
  *******************/
 
-extern void *
-wimlib_malloc(size_t size) _malloc_attribute;
+void *
+wimlib_malloc(size_t size);
 
-extern void
+void
 wimlib_free_memory(void *p);
 
-extern void *
+void *
 wimlib_realloc(void *ptr, size_t size);
 
-extern void *
-wimlib_calloc(size_t nmemb, size_t size) _malloc_attribute;
+void *
+wimlib_calloc(size_t nmemb, size_t size);
 
-extern char *
-wimlib_strdup(const char *str) _malloc_attribute;
+char *
+wimlib_strdup(const char *str);
 
-#ifdef __WIN32__
-extern wchar_t *
-wimlib_wcsdup(const wchar_t *str) _malloc_attribute;
+#ifdef _WIN32
+wchar_t *
+wimlib_wcsdup(const wchar_t *str);
 #endif
 
-extern void *
-wimlib_aligned_malloc(size_t size, size_t alignment) _malloc_attribute;
+void *
+wimlib_aligned_malloc(size_t size, size_t alignment);
 
-extern void
+void
 wimlib_aligned_free(void *ptr);
 
-extern void *
-memdup(const void *mem, size_t size) _malloc_attribute;
+void *
+memdup(const void *mem, size_t size);
 
 #define MALLOC         wimlib_malloc
 #define FREE           wimlib_free_memory
@@ -84,7 +85,7 @@ memdup(const void *mem, size_t size) _malloc_attribute;
  *******************/
 
 #ifndef HAVE_MEMPCPY
-extern void *
+void *
 mempcpy(void *dst, const void *src, size_t n);
 #endif
 
@@ -92,10 +93,10 @@ mempcpy(void *dst, const void *src, size_t n);
  * Random number generation
  **************************/
 
-extern void
+void
 get_random_bytes(void *p, size_t n);
 
-extern void
+void
 get_random_alnum_chars(tchar *p, size_t n);
 
 /************************