diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-11-24 22:15:43 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-11-24 22:15:43 +0000 |
commit | fef558eeb4923598b2c720f7cede49b3914141ab (patch) | |
tree | eac0988d3fb50fd40c9b3bfd86fb368bb87e73f1 | |
parent | 2cfa31e610a0ce3062335f049ce5d0386fce0911 (diff) | |
download | termo-fef558eeb4923598b2c720f7cede49b3914141ab.tar.gz termo-fef558eeb4923598b2c720f7cede49b3914141ab.tar.xz termo-fef558eeb4923598b2c720f7cede49b3914141ab.zip |
Use sizeof() on assigned variables rather than types, to make code a little less fragile to type changes
-rw-r--r-- | driver-ti.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/driver-ti.c b/driver-ti.c index f73d970..727cb78 100644 --- a/driver-ti.c +++ b/driver-ti.c @@ -46,7 +46,7 @@ static int register_seq(termkey_ti *ti, const char *seq, termkey_type type, term static struct trie_node *new_node_key(termkey_type type, termkey_keysym sym, int modmask, int modset) { - struct trie_node_key *n = malloc(sizeof(struct trie_node_key)); + struct trie_node_key *n = malloc(sizeof(*n)); if(!n) return NULL; @@ -62,7 +62,7 @@ static struct trie_node *new_node_key(termkey_type type, termkey_keysym sym, int static struct trie_node *new_node_arr(unsigned char min, unsigned char max) { - struct trie_node_arr *n = malloc(sizeof(struct trie_node_arr) + ((int)max-min+1) * sizeof(void*)); + struct trie_node_arr *n = malloc(sizeof(*n) + ((int)max-min+1) * sizeof(n->arr[0])); if(!n) return NULL; |