Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cast all sizeof to int
  • Loading branch information
timeyyy committed Jul 12, 2016
1 parent 09eaf67 commit a3cfb8e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/nvim/lib/kbtree.h
Expand Up @@ -33,6 +33,7 @@
#include <stdint.h>

#define KB_MAX_DEPTH 64
#define Isizeof(x) ((int)sizeof(x))

typedef struct {
int32_t is_internal:1, n:31;
Expand Down Expand Up @@ -62,14 +63,14 @@ typedef struct {
kbtree_##name##_t *kb_init_##name(int size) \
{ \
kbtree_##name##_t *b; \
b = (kbtree_##name##_t*)calloc(1, sizeof(kbtree_##name##_t)); \
b->t = ((size - 4 - sizeof(void*)) / (sizeof(void*) + sizeof(key_t)) + 1) >> 1; \
b = (kbtree_##name##_t*)calloc(1, Isizeof(kbtree_##name##_t)); \
b->t = ((size - 4 - Isizeof(void*)) / (Isizeof(void*) + Isizeof(key_t)) + 1) >> 1; \
if (b->t < 2) { \
free(b); return 0; \
} \
b->n = 2 * b->t - 1; \
b->off_ptr = 4 + b->n * sizeof(key_t); \
b->ilen = (4 + sizeof(void*) + b->n * (sizeof(void*) + sizeof(key_t)) + 3) >> 2 << 2; \
b->off_ptr = 4 + b->n * Isizeof(key_t); \
b->ilen = (4 + Isizeof(void*) + b->n * (Isizeof(void*) + Isizeof(key_t)) + 3) >> 2 << 2; \
b->elen = (b->off_ptr + 3) >> 2 << 2; \
b->root = (kbnode_t*)calloc(1, b->ilen); \
++b->n_nodes; \
Expand Down

0 comments on commit a3cfb8e

Please sign in to comment.