]> git.puffer.fish Git - mirror/frr.git/commit
lib: A small optimization for the hash iterate and walk functions 2474/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 16 Jun 2018 23:27:41 +0000 (19:27 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 17 Jun 2018 00:09:45 +0000 (20:09 -0400)
commit626e8d0a9b4830438276947d0c76d1fbf4c7884c
tree5cce0ff596a34a13e2c813c8a936eb693b56fcef
parent8872626bb4b8f5d9d06ea2b5e513e5ecb6a541aa
lib: A small optimization for the hash iterate and walk functions

When we are iterating through the hash, keep count of how many
we've called and if we have finished calling the hash->size
iterator times, then short-circuit and stop looping over
the entire array.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/hash.c
vtysh/vtysh.c