Data Structures | Macros | Typedefs
memline_defs.h File Reference
#include "nvim/memfile_defs.h"

Go to the source code of this file.

Data Structures

struct  info_pointer
struct  ml_chunksize
struct  memline


#define ML_CHNK_ADDLINE   1
#define ML_CHNK_DELLINE   2
#define ML_CHNK_UPDLINE   3
#define ML_EMPTY   1
#define ML_LINE_DIRTY   2
#define ML_LOCKED_DIRTY   4
#define ML_LOCKED_POS   8


typedef struct info_pointer infoptr_T
typedef struct ml_chunksize chunksize_T
typedef struct memline memline_T

Macro Definition Documentation


#define ML_CHNK_ADDLINE   1


#define ML_CHNK_DELLINE   2


#define ML_CHNK_UPDLINE   3


#define ML_EMPTY   1


#define ML_LINE_DIRTY   2


#define ML_LOCKED_DIRTY   4


#define ML_LOCKED_POS   8

Typedef Documentation

◆ chunksize_T

typedef struct ml_chunksize chunksize_T

◆ infoptr_T

typedef struct info_pointer infoptr_T

When searching for a specific line, we remember what blocks in the tree are the branches leading to that block. This is stored in ml_stack. Each entry is a pointer to info in a block (may be data block or pointer block)

◆ memline_T

typedef struct memline memline_T

memline structure: the contents of a buffer. Essentially a tree with a branch factor of 128. Lines are stored at leaf nodes. Nodes are stored on ml_mfp (memfile_T): pointer_block: internal nodes data_block: leaf nodes

Memline also has "chunks" of 800 lines that are separate from the 128-tree structure, primarily used to speed up line2byte() and byte2line().

Motivation: If you have a file that is 10000 lines long, and you insert a line at linenr 1000, you don't want to move 9000 lines in memory. With this structure it is roughly (N * 128) pointer moves, where N is the height (typically 1-3).