mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
throw somed attributes on a few functions
This commit is contained in:
parent
7e12436196
commit
7215bf92ad
@ -554,6 +554,7 @@ cell_init(cell* c){
|
||||
// Breaks the UTF-8 string in 'gcluster' down, setting up the cell 'c'. Returns
|
||||
// the number of bytes copied out of 'gcluster', or -1 on failure. The styling
|
||||
// of the cell is left untouched, but any resources are released.
|
||||
__attribute__ ((nonnull (1, 2, 3)))
|
||||
API int cell_load(struct ncplane* n, cell* c, const char* gcluster);
|
||||
|
||||
// cell_load(), plus blast the styling with 'attr' and 'channels'.
|
||||
|
@ -110,7 +110,7 @@ egcpool_alloc_justified(const egcpool* pool, int len){
|
||||
// should not be less than 2 bytes (such a cluster should be directly stored in
|
||||
// the cell). returns -1 on error, and otherwise a non-negative offset. 'ulen'
|
||||
// must be the number of bytes to lift from egc (utf8_egc_len()).
|
||||
static inline int
|
||||
__attribute__ ((nonnull (1, 2))) static inline int
|
||||
egcpool_stash(egcpool* pool, const char* egc, size_t ulen){
|
||||
int len = ulen + 1; // count the NUL terminator
|
||||
if(len <= 2){ // should never be empty, nor a single byte + NUL
|
||||
@ -236,8 +236,8 @@ egcpool_dump(egcpool* pool){
|
||||
pool->poolused = 0;
|
||||
}
|
||||
|
||||
static inline const char*
|
||||
egcpool_extended_gcluster(const egcpool* pool, const cell* c){
|
||||
__attribute__ ((__returns_nonnull__)) static inline const char*
|
||||
egcpool_extended_gcluster(const egcpool* pool, const cell* c) {
|
||||
uint32_t idx = cell_egc_idx(c);
|
||||
return pool->pool + idx;
|
||||
}
|
||||
|
@ -599,8 +599,9 @@ cell_duplicate_far(egcpool* tpool, cell* targ, const ncplane* splane, const cell
|
||||
targ->gcluster = c->gcluster;
|
||||
return !!c->gcluster;
|
||||
}
|
||||
size_t ulen = strlen(extended_gcluster(splane, c));
|
||||
int eoffset = egcpool_stash(tpool, extended_gcluster(splane, c), ulen);
|
||||
const char* egc = extended_gcluster(splane, c);
|
||||
size_t ulen = strlen(egc);
|
||||
int eoffset = egcpool_stash(tpool, egc, ulen);
|
||||
if(eoffset < 0){
|
||||
return -1;
|
||||
}
|
||||
|
@ -374,6 +374,7 @@ fprintf(stderr, "WROTE %u [%s] to %d/%d (%d/%d)\n", targc->gcluster, extended_gc
|
||||
return 0;
|
||||
}
|
||||
|
||||
// it's not a pure memset(), because CELL_ALPHA_OPAQUE is the zero value
|
||||
static void
|
||||
init_fb(cell* fb, int dimy, int dimx){
|
||||
for(int y = 0 ; y < dimy ; ++y){
|
||||
|
Loading…
x
Reference in New Issue
Block a user