I hereby claim:
- I am tvdw on github.
- I am tvdw (https://keybase.io/tvdw) on keybase.
- I have a public key whose fingerprint is D6F9 F239 E0C9 D283 5D3D E267 2DB3 6243 CF38 B160
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| class Object { | |
| public: | |
| int retainCount; | |
| void alloc(); | |
| virtual void dealloc(); | |
| void release(); | |
| void retain(); | |
| }; |
| class Sheep : Object { | |
| void makeNoise(); | |
| }; | |
| int main() { | |
| Sheep* sheep = new Sheep; // it is automatically retained once. | |
| // Do stuff with the sheep | |
| sheep.release(); // it is deallocated |
| // In the header file | |
| @property (retain) NSObject *obj; | |
| // In the code | |
| -(id)init { | |
| // WRONG: obj = [[NSData alloc] init]; // This won't call [obj retain]; !!!! | |
| [self setObj:[[NSData alloc] init]]; // CORRECT: [obj retain]; is called properly | |
| return self; | |
| } |
| static inline std::string jsonEscape(std::string &str) | |
| { | |
| std::string escaped = "\""; | |
| char buf[16]; | |
| unsigned int i; | |
| for (i = 0; i < str.size(); i++) | |
| { | |
| if (str[i] == 34) escaped += '\\'; |
| #include <string.h> | |
| #include <curl/curl.h> | |
| fd_set wfds; | |
| fd_set rfds; | |
| struct timeval tv; | |
| int maxfd = 0; | |
| int socket_callback(CURL *easy, /* easy handle */ | |
| curl_socket_t s, /* socket */ |
| #include <string.h> | |
| #include <assert.h> | |
| #include <curl/curl.h> | |
| fd_set wfds; | |
| fd_set rfds; | |
| struct timeval tv; | |
| int maxfd = 0; | |
| int socket_callback(CURL *easy, /* easy handle */ |
| #include <string.h> | |
| #include <curl/curl.h> | |
| fd_set wfds; | |
| fd_set rfds; | |
| struct timeval tv; | |
| int maxfd = 0; | |
| int socket_callback(CURL *easy, /* easy handle */ | |
| curl_socket_t s, /* socket */ |
| #include "curl/curl.h" | |
| int main(int argc, char** argv) | |
| { | |
| CURLM *multi = curl_multi_init(); | |
| curl_multi_setopt(multi, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX); | |
| curl_multi_setopt(multi, CURLMOPT_MAX_HOST_CONNECTIONS, 4); | |
| int j; | |
| for (j = 0; j < 100; j++) { |
| #include <string.h> | |
| #include <curl/curl.h> | |
| fd_set wfds; | |
| fd_set rfds; | |
| struct timeval tv; | |
| int maxfd = 0; | |
| int socket_callback(CURL *easy, /* easy handle */ | |
| curl_socket_t s, /* socket */ |