Skip to content

Commit

Permalink
sdsformatip() removed.
Browse files Browse the repository at this point in the history
Specialized single-use function. Not the best match for sds.c btw.
Also genClientPeerId() is no longer static: we need symbols.
  • Loading branch information
antirez committed Dec 11, 2014
1 parent ce269ad commit bbf0736
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
9 changes: 0 additions & 9 deletions src/sds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/sds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/sentinel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bbf0736

Please sign in to comment.