static void _create_uri(char *str) { uri = uri_create(str); ck_assert(uri); if (uri -> error) { printf("uri -> error: %s\n", data_tostring(uri -> error)); } ck_assert_ptr_eq(uri -> error, NULL); }
connection_t* connection_create(uri_t* _uri, string _name, int _socketfd) { connection_t* con = (connection_t*)malloc(sizeof(connection_t)); /* Set the SAPI uri */ con->uri = (_uri != NULL) ? uri_create(_uri->ip, _uri->port) : NULL; /* Set the name of the topic */ con->name = (char*)calloc(sizeof(char), strlen(_name) + 1); strcpy(con->name, _name); /* Set the socket */ con->socketfd = _socketfd; con->pending = FALSE; return con; }