dict.c: avoid code repetition in dictRehash().
dict.c: avoid code repetition in dictRehash().

Avoid code repetition introduced with PR #2367, also fixes the return
value to always return 0 if there is nothing more to rehash.

louisliangjun/redis,jxwr/redis,jxwr/redis,maodeyi/redis_lua,xuzhezhaozhao/redis_reading,himoca/redis,MSOpenTech/redis,ksarch-saas/redis,ksarch-saas/redis,HunanTV/redis,maodeyi/redis_lua,splitice/redis,splitice/redis,slfs007/mk-redis,louisliangjun/redis,ramonsnir/redis,ttuna/msot-redis,MSOpenTech/redis,spearhead-ea/redis,ttuna/msot-redis,xuzhezhaozhao/redis_reading,maodeyi/redis_lua,ttuna/msot-redis,ttuna/msot-redis,xuzhezhaozhao/redis_reading,slfs007/mk-redis,jxwr/redis,ramonsnir/redis,HunanTV/redis,xuzhezhaozhao/redis_reading,HunanTV/redis,himoca/redis,MSOpenTech/redis,ksarch-saas/redis,spearhead-ea/redis,louisliangjun/redis,MSOpenTech/redis,splitice/redis,louisliangjun/redis,splitice/redis,MSOpenTech/redis,ramonsnir/redis,spearhead-ea/redis,slfs007/mk-redis,himoca/redis,HunanTV/redis,ttuna/msot-redis,ksarch-saas/redis