add compiler.h to abstract gcc attributes

This commit is contained in:
leitner
2020-11-08 00:29:35 +00:00
parent 51869a80f8
commit ddfdd4d077
45 changed files with 701 additions and 332 deletions

44
array.h
View File

@@ -3,7 +3,8 @@
#define ARRAY_H
#include <stddef.h>
#include "uint64.h"
#include <libowfat/compiler.h>
#include <libowfat/uint64.h>
#ifdef __cplusplus
extern "C" {
@@ -21,25 +22,30 @@ typedef struct {
size_t headroom; /* the actual pointer for free() and realloc() is p-headroom */
} array;
void* array_allocate(array* x,uint64 membersize,int64 pos);
void* array_get(const array* const x,uint64 membersize,int64 pos);
void* array_start(const array* const x);
int64 array_length(const array* const x,uint64 membersize);
int64 array_bytes(const array* const x);
void array_truncate(array* x,uint64 membersize,int64 len);
void array_trunc(array* x);
void array_reset(array* x);
void array_fail(array* x);
int array_equal(const array* const x,const array* const y);
void array_cat(array* to,const array* const from);
void array_catb(array* to,const char* from,uint64 len);
void array_cats(array* to,const char* from);
void array_cats0(array* to,const char* from);
void array_cat0(array* to);
void array_cate(array* to,const array* const from,int64 pos,int64 stop);
void* array_allocate(array* x,uint64 membersize,int64 pos) noexcept;
void* array_get(const array* const x,uint64 membersize,int64 pos) noexcept;
void* array_start(const array* const x) noexcept;
void array_shift(array* x,uint64 membersize,uint64 members);
void array_chop(array* x,uint64 membersize,uint64 members);
att_pure
int64 array_length(const array* const x,uint64 membersize) noexcept;
att_pure
int64 array_bytes(const array* const x) noexcept;
void array_truncate(array* x,uint64 membersize,int64 len) noexcept;
void array_trunc(array* x) noexcept;
void array_reset(array* x) noexcept;
void array_fail(array* x) noexcept;
int array_equal(const array* const x,const array* const y) noexcept;
void array_cat(array* to,const array* const from) noexcept;
void array_catb(array* to,const char* from,uint64 len) noexcept;
void array_cats(array* to,const char* from) noexcept;
void array_cats0(array* to,const char* from) noexcept;
void array_cat0(array* to) noexcept;
void array_cate(array* to,const array* const from,int64 pos,int64 stop) noexcept;
void array_shift(array* x,uint64 membersize,uint64 members) noexcept;
void array_chop(array* x,uint64 membersize,uint64 members) noexcept;
#define array_failed(x) (array_bytes(x)==-1)
#define array_unallocated(x) (array_bytes(x)==0)