mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00: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
|
// 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
|
// 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.
|
// 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);
|
API int cell_load(struct ncplane* n, cell* c, const char* gcluster);
|
||||||
|
|
||||||
// cell_load(), plus blast the styling with 'attr' and 'channels'.
|
// 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
|
// 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'
|
// 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()).
|
// 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){
|
egcpool_stash(egcpool* pool, const char* egc, size_t ulen){
|
||||||
int len = ulen + 1; // count the NUL terminator
|
int len = ulen + 1; // count the NUL terminator
|
||||||
if(len <= 2){ // should never be empty, nor a single byte + NUL
|
if(len <= 2){ // should never be empty, nor a single byte + NUL
|
||||||
@ -236,7 +236,7 @@ egcpool_dump(egcpool* pool){
|
|||||||
pool->poolused = 0;
|
pool->poolused = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char*
|
__attribute__ ((__returns_nonnull__)) static inline const char*
|
||||||
egcpool_extended_gcluster(const egcpool* pool, const cell* c) {
|
egcpool_extended_gcluster(const egcpool* pool, const cell* c) {
|
||||||
uint32_t idx = cell_egc_idx(c);
|
uint32_t idx = cell_egc_idx(c);
|
||||||
return pool->pool + idx;
|
return pool->pool + idx;
|
||||||
|
@ -599,8 +599,9 @@ cell_duplicate_far(egcpool* tpool, cell* targ, const ncplane* splane, const cell
|
|||||||
targ->gcluster = c->gcluster;
|
targ->gcluster = c->gcluster;
|
||||||
return !!c->gcluster;
|
return !!c->gcluster;
|
||||||
}
|
}
|
||||||
size_t ulen = strlen(extended_gcluster(splane, c));
|
const char* egc = extended_gcluster(splane, c);
|
||||||
int eoffset = egcpool_stash(tpool, extended_gcluster(splane, c), ulen);
|
size_t ulen = strlen(egc);
|
||||||
|
int eoffset = egcpool_stash(tpool, egc, ulen);
|
||||||
if(eoffset < 0){
|
if(eoffset < 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -374,6 +374,7 @@ fprintf(stderr, "WROTE %u [%s] to %d/%d (%d/%d)\n", targc->gcluster, extended_gc
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// it's not a pure memset(), because CELL_ALPHA_OPAQUE is the zero value
|
||||||
static void
|
static void
|
||||||
init_fb(cell* fb, int dimy, int dimx){
|
init_fb(cell* fb, int dimy, int dimx){
|
||||||
for(int y = 0 ; y < dimy ; ++y){
|
for(int y = 0 ; y < dimy ; ++y){
|
||||||
|
Loading…
Reference in New Issue
Block a user