mirror of
https://github.com/fluencelabs/redis
synced 2025-06-22 05:21:33 +00:00
Cleanup all IP formatting code
Instead of manually checking for strchr(n,':') everywhere, we can use our new centralized IP formatting functions.
This commit is contained in:
@ -130,9 +130,8 @@ static void cliRefreshPrompt(void) {
|
||||
len = snprintf(config.prompt,sizeof(config.prompt),"redis %s",
|
||||
config.hostsocket);
|
||||
else
|
||||
len = snprintf(config.prompt,sizeof(config.prompt),
|
||||
strchr(config.hostip,':') ? "[%s]:%d" : "%s:%d",
|
||||
config.hostip, config.hostport);
|
||||
len = anetFormatIP(config.prompt, sizeof(config.prompt),
|
||||
config.hostip, config.hostport);
|
||||
/* Add [dbnum] if needed */
|
||||
if (config.dbnum != 0 && config.last_cmd_type != REDIS_REPLY_ERROR)
|
||||
len += snprintf(config.prompt+len,sizeof(config.prompt)-len,"[%d]",
|
||||
|
Reference in New Issue
Block a user