mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
sdsformatip() removed.
Specialized single-use function. Not the best match for sds.c btw. Also genClientPeerId() is no longer static: we need symbols.
This commit is contained in:
parent
ce269ad3c5
commit
bbf0736c4e
@ -1230,7 +1230,7 @@ void getClientsMaxBuffers(unsigned long *longest_output_list,
|
||||
* On failure the function still populates 'peerid' with the "?:0" string
|
||||
* in case you want to relax error checking or need to display something
|
||||
* anyway (see anetPeerToString implementation for more info). */
|
||||
static void genClientPeerId(redisClient *client, char *peerid,
|
||||
void genClientPeerId(redisClient *client, char *peerid,
|
||||
size_t peerid_len) {
|
||||
if (client->flags & REDIS_UNIX_SOCKET) {
|
||||
/* Unix socket client. */
|
||||
|
@ -962,15 +962,6 @@ sds sdsjoin(char **argv, int argc, char *sep) {
|
||||
return join;
|
||||
}
|
||||
|
||||
sds sdsformatip(char *ip, int port) {
|
||||
if (port >= 0)
|
||||
return sdscatfmt(sdsempty(),
|
||||
strchr(ip,':') ? "[%s]:%i" : "%s:%i", ip, port);
|
||||
else
|
||||
return sdscatfmt(sdsempty(),
|
||||
strchr(ip,':') ? "[%s]" : "%s", ip);
|
||||
}
|
||||
|
||||
#ifdef SDS_TEST_MAIN
|
||||
#include <stdio.h>
|
||||
#include "testhelp.h"
|
||||
|
@ -91,7 +91,6 @@ sds sdscatrepr(sds s, const char *p, size_t len);
|
||||
sds *sdssplitargs(const char *line, int *argc);
|
||||
sds sdsmapchars(sds s, const char *from, const char *to, size_t setlen);
|
||||
sds sdsjoin(char **argv, int argc, char *sep);
|
||||
sds sdsformatip(char *ip, int port);
|
||||
|
||||
/* Low level functions exposed to the user API */
|
||||
sds sdsMakeRoomFor(sds s, size_t addlen);
|
||||
|
@ -1031,9 +1031,11 @@ sentinelRedisInstance *sentinelRedisInstanceLookupSlave(
|
||||
{
|
||||
sds key;
|
||||
sentinelRedisInstance *slave;
|
||||
char buf[REDIS_PEER_ID_LEN];
|
||||
|
||||
redisAssert(ri->flags & SRI_MASTER);
|
||||
key = sdsformatip(ip, port);
|
||||
anetFormatAddr(buf,sizeof(buf),ip,port);
|
||||
key = sdsnew(buf);
|
||||
slave = dictFetchValue(ri->slaves,key);
|
||||
sdsfree(key);
|
||||
return slave;
|
||||
|
Loading…
x
Reference in New Issue
Block a user