Notcurses 3.0.13
a blingful library for TUIs and character graphics
Loading...
Searching...
No Matches
egcpool.h File Reference
#include <wchar.h>
#include <errno.h>
#include <stdio.h>
#include <wctype.h>
#include <stddef.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <unigbrk.h>
#include <unictype.h>
#include "notcurses/notcurses.h"
#include "compat/compat.h"
#include "logging.h"
Include dependency graph for egcpool.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  egcpool
 

Macros

#define POOL_MINIMUM_ALLOC   BUFSIZ
 
#define POOL_MAXIMUM_BYTES   (1 << 24)
 

Typedefs

typedef struct egcpool egcpool
 

Functions

 __attribute__ ((nonnull(1, 2))) static inline int egcpool_stash(egcpool *pool
 
 if (len<=2)
 
 while ((searched=!searched))
 
 free (duplicated)
 
 assert (false)
 
 __attribute__ ((__returns_nonnull__)) static inline const char *egcpool_extended_gcluster(const egcpool *pool
 

Variables

const char * egc
 
const char size_t ulen
 
bool searched = false
 
char * duplicated = NULL
 
 do
 
 return
 
const nccellc
 
uint32_t idx = cell_egc_idx(c)
 

Macro Definition Documentation

◆ POOL_MAXIMUM_BYTES

#define POOL_MAXIMUM_BYTES   (1 << 24)

Definition at line 36 of file egcpool.h.

◆ POOL_MINIMUM_ALLOC

#define POOL_MINIMUM_ALLOC   BUFSIZ

Definition at line 35 of file egcpool.h.

Typedef Documentation

◆ egcpool

typedef struct egcpool egcpool

Function Documentation

◆ __attribute__() [1/2]

__attribute__ ( (__returns_nonnull__)  ) const

◆ __attribute__() [2/2]

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

◆ assert()

assert ( false  )
Here is the caller graph for this function:

◆ free()

free ( duplicated  )

◆ if()

if ( len<=  2)

Definition at line 175 of file egcpool.h.

175 { // should never be empty, nor a single byte + NUL
176 return -1;
177 }

◆ while()

while ( (searched=!searched )

Variable Documentation

◆ c

API int const nccell * c
Initial value:
{
assert(cell_extended_p(c))
assert(false)
const nccell * c
Definition egcpool.h:296

Definition at line 296 of file egcpool.h.

◆ do

do
Initial value:
{
if(egcpool_alloc_justified(pool, len) || searched){
if(!duplicated){
if((duplicated = (char *)malloc(ulen + 1)) == NULL){
return -1;
}
memcpy(duplicated, egc, ulen);
duplicated[ulen] = '\0';
}
if(egcpool_grow(pool, len) && searched){
return -1;
}
}
int curpos = pool->poolwrite
const char * egc
Definition egcpool.h:173
const char size_t ulen
Definition egcpool.h:173
bool searched
Definition egcpool.h:181
free(duplicated)
char * duplicated
Definition egcpool.h:185
API int API int const nccell unsigned len
Definition notcurses.h:2588
return NULL
Definition termdesc.h:229

Definition at line 186 of file egcpool.h.

186 {
187 if(egcpool_alloc_justified(pool, len) || searched){
188 if(!duplicated){
189 // cast (and avoidance of strndup) to facilitate c++ inclusions
190 if((duplicated = (char *)malloc(ulen + 1)) == NULL){
191 return -1;
192 }
193 memcpy(duplicated, egc, ulen);
194 duplicated[ulen] = '\0';
195 }
196 if(egcpool_grow(pool, len) && searched){
198 return -1;
199 }
200 egc = duplicated;
201 }

◆ duplicated

char* duplicated = NULL

Definition at line 185 of file egcpool.h.

◆ egc

const char* egc

Definition at line 173 of file egcpool.h.

◆ idx

return pool pool idx = cell_egc_idx(c)

Definition at line 298 of file egcpool.h.

◆ return

return

Definition at line 247 of file egcpool.h.

◆ searched

bool searched = false

Definition at line 181 of file egcpool.h.

◆ ulen

const char size_t ulen
Initial value:
{
int len = ulen + 1

Definition at line 173 of file egcpool.h.