liblzma: Move a few __attribute__ uses in function declarations.

The API headers have many attributes but these were left
as is for now.
This commit is contained in:
Lasse Collin 2023-09-11 18:47:26 +03:00 committed by Jia Tan
parent b71b8922ef
commit e3478ae4f3
3 changed files with 10 additions and 7 deletions

View File

@ -35,7 +35,8 @@ lzma_version_string(void)
// Memory allocation // // Memory allocation //
/////////////////////// ///////////////////////
extern void * lzma_attr_alloc_size(1) lzma_attr_alloc_size(1)
extern void *
lzma_alloc(size_t size, const lzma_allocator *allocator) lzma_alloc(size_t size, const lzma_allocator *allocator)
{ {
// Some malloc() variants return NULL if called with size == 0. // Some malloc() variants return NULL if called with size == 0.
@ -53,7 +54,8 @@ lzma_alloc(size_t size, const lzma_allocator *allocator)
} }
extern void * lzma_attr_alloc_size(1) lzma_attr_alloc_size(1)
extern void *
lzma_alloc_zero(size_t size, const lzma_allocator *allocator) lzma_alloc_zero(size_t size, const lzma_allocator *allocator)
{ {
// Some calloc() variants return NULL if called with size == 0. // Some calloc() variants return NULL if called with size == 0.

View File

@ -297,14 +297,14 @@ struct lzma_internal_s {
/// Allocates memory /// Allocates memory
extern void *lzma_alloc(size_t size, const lzma_allocator *allocator) lzma_attr_alloc_size(1)
lzma_attr_alloc_size(1); extern void *lzma_alloc(size_t size, const lzma_allocator *allocator);
/// Allocates memory and zeroes it (like calloc()). This can be faster /// Allocates memory and zeroes it (like calloc()). This can be faster
/// than lzma_alloc() + memzero() while being backward compatible with /// than lzma_alloc() + memzero() while being backward compatible with
/// custom allocators. /// custom allocators.
extern void * lzma_attr_alloc_size(1) lzma_attr_alloc_size(1)
lzma_alloc_zero(size_t size, const lzma_allocator *allocator); extern void *lzma_alloc_zero(size_t size, const lzma_allocator *allocator);
/// Frees memory /// Frees memory
extern void lzma_free(void *ptr, const lzma_allocator *allocator); extern void lzma_free(void *ptr, const lzma_allocator *allocator);

View File

@ -49,7 +49,8 @@
/// It's rounded up to 2^n. This extra amount needs to be /// It's rounded up to 2^n. This extra amount needs to be
/// allocated in the buffers being used. It needs to be /// allocated in the buffers being used. It needs to be
/// initialized too to keep Valgrind quiet. /// initialized too to keep Valgrind quiet.
static inline uint32_t lzma_attribute((__always_inline__)) lzma_attribute((__always_inline__))
static inline uint32_t
lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2, lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2,
uint32_t len, uint32_t limit) uint32_t len, uint32_t limit)
{ {