mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-13 12:44:34 +03:00
Refactor __attribute__ usage
Use internal macros for compatibility with non GNUC compilers.
This commit is contained in:

committed by
cgzones

parent
f4602f7b4e
commit
7107d1db0b
8
XAlloc.c
8
XAlloc.c
@ -53,14 +53,6 @@ void* xRealloc(void* ptr, size_t size) {
|
||||
# define xStrdup(str_) (assert(str_), xStrdup_(str_))
|
||||
#endif
|
||||
|
||||
#ifndef __has_attribute // Clang's macro
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
#if (__has_attribute(nonnull) || \
|
||||
((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)))
|
||||
char* xStrdup_(const char* str) __attribute__((nonnull));
|
||||
#endif // __has_attribute(nonnull) || GNU C 3.3 or later
|
||||
|
||||
char* xStrdup_(const char* str) {
|
||||
char* data = strdup(str);
|
||||
if (!data) {
|
||||
|
Reference in New Issue
Block a user