From 00ffccd9a6d9b7f484c2e421be33aea3975a2879 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 2 Sep 2014 12:48:34 -0400 Subject: Another clang analyzer complaint wrt HT_GENERATE We're calling mallocfn() and reallocfn() in the HT_GENERATE macro with the result of a product. But that makes any sane analyzer worry about overflow. This patch keeps HT_GENERATE having its old semantics, since we aren't the only project using ht.h. Instead, define a HT_GENERATE2 that takes a reallocarrayfn. --- src/or/microdesc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/or/microdesc.c') diff --git a/src/or/microdesc.c b/src/or/microdesc.c index fdb549a9ac..ed586f37c2 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -57,9 +57,9 @@ microdesc_eq_(microdesc_t *a, microdesc_t *b) HT_PROTOTYPE(microdesc_map, microdesc_t, node, microdesc_hash_, microdesc_eq_); -HT_GENERATE(microdesc_map, microdesc_t, node, +HT_GENERATE2(microdesc_map, microdesc_t, node, microdesc_hash_, microdesc_eq_, 0.6, - malloc, realloc, free); + tor_reallocarray_, tor_free_) /** Write the body of md into f, with appropriate annotations. * On success, return the total number of bytes written, and set -- cgit v1.2.3-54-g00ecf