This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int redisContextConnectTcp(redisContext *c, const char *addr, int port, struct timeval *timeout) { | |
int s, rv; | |
char _port[6]; /* strlen("65535"); */ | |
struct addrinfo hints, *servinfo, *p; | |
int blocking = (c->flags & REDIS_BLOCK); | |
snprintf(_port, 6, "%d", port); | |
memset(&hints,0,sizeof(hints)); | |
hints.ai_family = AF_INET; | |
hints.ai_socktype = SOCK_STREAM; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "cstr.h" | |
cstr cstr_new_len(const char *str, int len) | |
{ | |
cstr_internal *ci; | |
int size; | |
size = sizeof(cstr_internal) + len + 1; | |
if(str) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
template <typename F, typename T1, typename T2> | |
void flip2(F f, T1 &&t1, T2 &&t2) | |
{ | |
f(t2, t1); | |
} | |
void g(int &&i, int &j) | |
{ |