diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-10-21 00:19:58 +0200 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-06 22:53:42 +0100 |
commit | 200f8ee0e572670f595d18853d18ccb8d3326db3 (patch) | |
tree | 272a6b13ef063f1e9176bced61d19631064e49b3 /src/nvim/memfile_defs.h | |
parent | 7ffed667d4ed1214e31d9f13bc1bd30f116c1b79 (diff) | |
download | rneovim-200f8ee0e572670f595d18853d18ccb8d3326db3.tar.gz rneovim-200f8ee0e572670f595d18853d18ccb8d3326db3.tar.bz2 rneovim-200f8ee0e572670f595d18853d18ccb8d3326db3.zip |
Review: Remove long_u: memfile: Refactor: long_u -> size_t.
- memfile_defs.h:
* hashtab_T: mht_mask: long_u -> size_t.
Masks are used to truncate keys to a value adequate for an index
in the array of entries. Value of the mask plus one is the
current size of the array. Both of those reasons imply the
soundness of size_t for this type.
* hashtab_T: mht_count: long_u -> size_t.
- memfile.c:
* total_mem_used: long_u -> size_t.
* mf_hash_free_all: idx: long_u -> size_t.
* mf_hash_add_item: idx: long_u -> size_t.
* mf_hash_find: idx: long_u -> size_t.
* mf_hash_grow: i: long_u -> size_t.
* mf_hash_grow: j: long_u -> size_t.
Diffstat (limited to 'src/nvim/memfile_defs.h')
-rw-r--r-- | src/nvim/memfile_defs.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h index ebecdea3a0..723270f760 100644 --- a/src/nvim/memfile_defs.h +++ b/src/nvim/memfile_defs.h @@ -1,6 +1,7 @@ #ifndef NVIM_MEMFILE_DEFS_H #define NVIM_MEMFILE_DEFS_H +#include <stdint.h> #include "nvim/types.h" /// A block number. @@ -24,7 +25,7 @@ typedef struct mf_hashitem { } mf_hashitem_T; /// Initial size for a hashtable. -#define MHT_INIT_SIZE 64 +#define MHT_INIT_SIZE 64 /// A chained hashtable with block numbers as keys and arbitrary data structures /// as items. @@ -33,9 +34,9 @@ typedef struct mf_hashitem { /// mf_hashitem_T which contains the key and linked list pointers. List of items /// in each bucket is doubly-linked. typedef struct mf_hashtab { - long_u mht_mask; /// mask used to mod hash value to array index + size_t mht_mask; /// mask used to mod hash value to array index /// (nr of items in array is 'mht_mask + 1') - long_u mht_count; /// number of items inserted + size_t mht_count; /// number of items inserted mf_hashitem_T **mht_buckets; /// points to the array of buckets (can be /// mht_small_buckets or a newly allocated array /// when mht_small_buckets becomes too small) |