diff options
author | Binbin <binloveplay1314@qq.com> | 2021-12-19 23:52:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-19 17:52:23 +0200 |
commit | 0fb1aa0645fd1e31d12c8d57d4326ded0aa4d555 (patch) | |
tree | a997d5739941b6036dc21fa57d489c273148669a /src/dict.c | |
parent | 6add1b7217458dab90b2458e4bac3fa9a2c15e1b (diff) | |
download | redis-0fb1aa0645fd1e31d12c8d57d4326ded0aa4d555.tar.gz |
Fix some nonsense came from LGTM (#9962)
1. Local variable 's' hides a parameter of the same name.
```
int anetTcpAccept(char *err, int s, char *ip, size_t ip_len, int *port) {
if ((fd = anetGenericAccept(err,s,(struct sockaddr*)&sa,&salen)) == ANET_ERR){}
}
```
Change the parameter name from `s` to `serversock`,
also unified with the header file definition.
2. Comparison is always false because i <= 48.
```
for (i = 0; i < DICT_STATS_VECTLEN-1; i++) { // i < 49
(i == DICT_STATS_VECTLEN-1)?">= ":"", // i == 49
}
```
`i == DICT_STATS_VECTLEN-1` always result false, it is a dead code.
3. Empty block without comment.
`else if (!strcasecmp(opt,"ch")) {}`, add a comment to avoid warnings.
4. Bit field fill of type int should have explicitly unsigned integral, explicitly signed integral, or enumeration type.
Modify `int fill: QL_FILL_BITS;` to `unsigned int fill: QL_FILL_BITS;`
5. The result of this call to reconnectingRedisCommand is not checked for null, but 80% of calls to reconnectingRedisCommand check for null.
Just a cleanup job like others.
Diffstat (limited to 'src/dict.c')
-rw-r--r-- | src/dict.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/dict.c b/src/dict.c index 1420055e7..9d96c6c27 100644 --- a/src/dict.c +++ b/src/dict.c @@ -1154,8 +1154,7 @@ size_t _dictGetStatsHt(char *buf, size_t bufsize, dict *d, int htidx) { if (clvector[i] == 0) continue; if (l >= bufsize) break; l += snprintf(buf+l,bufsize-l, - " %s%ld: %ld (%.02f%%)\n", - (i == DICT_STATS_VECTLEN-1)?">= ":"", + " %ld: %ld (%.02f%%)\n", i, clvector[i], ((float)clvector[i]/DICTHT_SIZE(d->ht_size_exp[htidx]))*100); } |