Notcurses 3.0.16
a blingful library for TUIs and character graphics
Loading...
Searching...
No Matches
egcpool.c File Reference
#include <lib/egcpool.h>
Include dependency graph for egcpool.c:

Go to the source code of this file.

Functions

 __attribute__ ((nonnull(1)))
 
 __attribute__ ((nonnull(1, 2)))
 

Function Documentation

◆ __attribute__() [1/2]

__attribute__ ( (nonnull(1))  )

Definition at line 4 of file egcpool.c.

5 {
6 const int poolfree = pool->poolsize - pool->poolused;
7 // proactively get more space if we have less than 10% free. this doesn't
8 // guarantee that we'll have enough space to insert the string -- we could
9 // theoretically have every 10th byte free, and be unable to write even a
10 // two-byte egc -- so we might have to allocate after an expensive search :/.
11 if(poolfree >= len && poolfree * 10 > pool->poolsize){
12 return false;
13 }
14 return true;
15}
API int API int const nccell unsigned len
Definition notcurses.h:2592

◆ __attribute__() [2/2]

API int __attribute__ ( (nonnull(1, 2))  )

Definition at line 17 of file egcpool.c.

18 {
19 memcpy(pool->pool + curpos, egc, len - 1);
20 pool->pool[curpos + len - 1] = '\0';
21 pool->poolwrite = curpos + len;
22 pool->poolused += len;
23//fprintf(stderr, "Stashing AT %d\n", curpos);
24 return curpos;
25}
const char * egc
Definition egcpool.h:162