d0da003d5b (use a hashmap to make remotes faster, 2014-07-29) adds an assert to check that the key added to remote hashmap was unique, which should never trigger, unless this function is used incorrectly. this breaks the build with -DNDEBUG because the assert gets compiled out and therefore the variable used to check is never used remote it and use instead a BUG(), which just like the assert is not expected to trigger, but will stay put and report regardless of how the code is compiled. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx> --- remote.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remote.c b/remote.c index dfb863d808..ab9dd35582 100644 --- a/remote.c +++ b/remote.c @@ -135,7 +135,7 @@ static inline void init_remotes_hash(void) static struct remote *make_remote(const char *name, int len) { - struct remote *ret, *replaced; + struct remote *ret; struct remotes_hash_key lookup; struct hashmap_entry lookup_entry, *e; @@ -162,8 +162,8 @@ static struct remote *make_remote(const char *name, int len) remotes[remotes_nr++] = ret; hashmap_entry_init(&ret->ent, lookup_entry.hash); - replaced = hashmap_put_entry(&remotes_hash, ret, ent); - assert(replaced == NULL); /* no previous entry overwritten */ + if (hashmap_put_entry(&remotes_hash, ret, ent)) + BUG("A remote hash collition was detected"); return ret; } -- 2.33.0.481.g26d3bed244