diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-03-29 11:47:23 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-03-30 14:03:12 +0200 |
| commit | 8bd6650245d050e455cd4d26f6e59e7dd9b80392 (patch) | |
| tree | b1ceb33eef645de3cbd4581c46a87dc4dc38a53f /vis.c | |
| parent | d407940b6fbbca2eab8a691e4e6d8c3659cbb862 (diff) | |
| download | vis-8bd6650245d050e455cd4d26f6e59e7dd9b80392.tar.gz vis-8bd6650245d050e455cd4d26f6e59e7dd9b80392.tar.xz | |
array: allow arbitrarily sized array elements
There exist two typical ways to use an array:
1) to hold pointers to externally allocated memory regions
Use array_init(...) for initialization, an element has the
size of a pointer. Use the functions suffixed with `_ptr'
to manage your pointers. The cleanup function array_release_full
must only be used with this type of array.
2) to hold arbitrary sized objects
Use array_init_sized(...) to specify the size of a single
element. Use the regular (i.e. without the `_ptr' suffix)
functions to manage your objects. array_get will return a
pointer to the object stored within the array.
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -319,6 +319,8 @@ Vis *vis_new(Ui *ui, VisEvent *event) { vis->expandtab = false; vis->registers[VIS_REG_BLACKHOLE].type = REGISTER_BLACKHOLE; vis->registers[VIS_REG_CLIPBOARD].type = REGISTER_CLIPBOARD; + array_init(&vis->motions); + array_init(&vis->textobjects); action_reset(&vis->action); if (!(vis->command_file = file_new_internal(vis, NULL))) goto err; |
