ze
Loading...
Searching...
No Matches
Files | Classes | Macros | Functions
Collaboration diagram for Append buffer:

Files

file  buffer.c
 Implementation of the append-only output buffer.
 

Classes

struct  abuf
 

Macros

#define ABUF_INIT   {NULL, 0}
 

Functions

void abAppend (struct abuf *ab, const char *s, int len)
 Append raw bytes to the dynamic append buffer.
 
void abFree (struct abuf *ab)
 Free the memory held by an append buffer.
 

Detailed Description

Macro Definition Documentation

◆ ABUF_INIT

#define ABUF_INIT   {NULL, 0}

Initializer macro for an empty append buffer.

Function Documentation

◆ abAppend()

void abAppend ( struct abuf ab,
const char *  s,
int  len 
)

Append raw bytes to the dynamic append buffer.

Parameters
abTarget buffer
sString data to append
lenLength of s

Reallocates the buffer as needed and copies the requested number of bytes to the end of the buffer. The resulting buffer is not NUL-terminated; use the maintained length field ab->len.

Postcondition
On success, ab->b may be reallocated and ab->len increases by the number of appended bytes.
Note
On allocation failure, the function returns early and leaves the buffer unchanged.
See also
abFree(), editorDrawRows(), editorRefreshScreen()

◆ abFree()

void abFree ( struct abuf ab)

Free the memory held by an append buffer.

Releases ab->b if non-NULL. Does not reset ab->len to 0.

Parameters
[in,out]abAppend buffer whose storage should be freed.
See also
abAppend()