本文整理汇总了C++中RFREE函数的典型用法代码示例。如果您正苦于以下问题:C++ RFREE函数的具体用法?C++ RFREE怎么用?C++ RFREE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RFREE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: riack_free_copied_rpb_pair
/**
* Free all memory associated with a RpbPair
*/
void riack_free_copied_rpb_pair(riack_client* client, RpbPair* ppair)
{
RFREE(client, ppair->key.data);
if (ppair->has_value) {
RFREE(client, ppair->value.data);
}
}
示例2: riack_free_copied_pair
void riack_free_copied_pair(riack_client* client, riack_pair *ppair)
{
RFREE(client, ppair->key.value);
if (ppair->value_present) {
RFREE(client, ppair->value);
}
}
示例3: nr_turn_stun_set_auth_params
static int nr_turn_stun_set_auth_params(nr_turn_stun_ctx *ctx,
char *realm, char *nonce)
{
int _status;
RFREE(ctx->realm);
RFREE(ctx->nonce);
assert(realm);
if (!realm)
ABORT(R_BAD_ARGS);
ctx->realm=r_strdup(realm);
if (!ctx->realm)
ABORT(R_NO_MEMORY);
assert(nonce);
if (!nonce)
ABORT(R_BAD_ARGS);
ctx->nonce=r_strdup(nonce);
if (!ctx->nonce)
ABORT(R_NO_MEMORY);
RFREE(ctx->stun->realm);
ctx->stun->realm = r_strdup(ctx->realm);
if (!ctx->stun->realm)
ABORT(R_NO_MEMORY);
ctx->stun->auth_params.realm = ctx->realm;
ctx->stun->auth_params.nonce = ctx->nonce;
ctx->stun->auth_params.authenticate = 1; /* May already be 1 */
_status=0;
abort:
return(_status);
}
示例4: riak_free_copied_rpb_pair
/**
* Free all memory associated with a RpbPair
*/
void riak_free_copied_rpb_pair(struct RIACK_CLIENT* client, RpbPair* ppair)
{
RFREE(client, ppair->key.data);
if (ppair->has_value) {
RFREE(client, ppair->value.data);
}
}
示例5: riack_send_message
int riack_send_message(struct RIACK_CLIENT *client, struct RIACK_PB_MSG* msg)
{
uint8_t *buf;
uint32_t netlen, sendlen;
sendlen = 5 + msg->msg_len;
buf = (uint8_t*)RMALLOC(client, sendlen);
netlen = htonl(msg->msg_len+1);
memcpy(buf, &netlen, 4);
buf[4] = msg->msg_code;
if (msg->msg_len > 0)
{
memcpy(buf+5, msg->msg, (int)msg->msg_len);
}
// first send header
if (sock_send(client->sockfd, buf, sendlen) != sendlen)
{
printf("sock_send failed to send correct number of bytes\n");
// Error failed to send bytes most have lost connection
RFREE(client, buf);
return -1;
}
RFREE(client, buf);
return sendlen;
}
示例6: nr_ice_candidate_pair_destroy
int nr_ice_candidate_pair_destroy(nr_ice_cand_pair **pairp)
{
nr_ice_cand_pair *pair;
if(!pairp || !*pairp)
return(0);
pair=*pairp;
*pairp=0;
RFREE(pair->as_string);
RFREE(pair->foundation);
nr_ice_socket_deregister(pair->local->isock,pair->stun_client_handle);
if (pair->stun_client) {
RFREE(pair->stun_client->params.ice_binding_request.username);
RFREE(pair->stun_client->params.ice_binding_request.password.data);
nr_stun_client_ctx_destroy(&pair->stun_client);
}
NR_async_timer_cancel(pair->stun_cb_timer);
NR_async_timer_cancel(pair->restart_role_change_cb_timer);
NR_async_timer_cancel(pair->restart_nominated_cb_timer);
RFREE(pair);
return(0);
}
示例7: riack_free_copied_rpb_put_req
/**
* Free alle memory associated with a RpbPutReq
*/
void riack_free_copied_rpb_put_req(struct RIACK_CLIENT* client, RpbPutReq* pput_req)
{
if (pput_req) {
RFREE(client, pput_req->bucket.data);
RFREE(client, pput_req->vclock.data);
RFREE(client, pput_req->key.data);
riak_free_copied_rpb_content(client, pput_req->content);
RFREE(client, pput_req->content);
}
}
示例8: riack_free
void riack_free(struct RIACK_CLIENT *client)
{
if (client != 0) {
if (client->last_error) {
RFREE(client, client->last_error);
}
if (client->host) {
RFREE(client, client->host);
}
riack_disconnect(client);
client->allocator.free(0, client);
}
}
示例9: riack_message_free
void riack_message_free(struct RIACK_CLIENT *client, struct RIACK_PB_MSG** ppMsg)
{
struct RIACK_PB_MSG* pMsg = *ppMsg;
if (pMsg != 0)
{
if (pMsg->msg_len > 0 && pMsg->msg != 0)
{
RFREE(client, pMsg->msg);
}
RFREE(client, pMsg);
}
*ppMsg = 0;
}
示例10: riak_free_content
void riak_free_content(struct RIACK_CLIENT* client, struct RIACK_CONTENT *pcontent)
{
size_t cnt, i;
RFREE(client, pcontent->charset.value);
RFREE(client, pcontent->content_encoding.value);
RFREE(client, pcontent->content_type.value);
RFREE(client, pcontent->vtag.value);
if (pcontent->data_len > 0) {
RFREE(client, pcontent->data);
}
cnt = pcontent->index_count;
if (cnt > 0) {
for (i=0; i<cnt; ++i) {
riak_free_copied_pair(client, &pcontent->indexes[i]);
}
RFREE(client,pcontent->indexes);
}
cnt = pcontent->usermeta_count;
if (cnt > 0) {
for (i=0; i<cnt; ++i) {
riak_free_copied_pair(client, &pcontent->usermetas[i]);
}
RFREE(client,pcontent->usermetas);
}
cnt = pcontent->link_count;
if (cnt > 0) {
for (i=0; i<cnt; ++i) {
riak_free_copied_link(client, &pcontent->links[i]);
}
RFREE(client,pcontent->links);
}
}
示例11: riack_free_mapred_result
void riack_free_mapred_result(struct RIACK_CLIENT* client, struct RIACK_MAPRED_RESULT *result)
{
struct RIACK_MAPRED_RESULT *current, *last;
current = result;
last = 0;
while (current) {
if (current->data_size > 0 && current->data) {
RFREE(client, current->data);
}
last = current;
current = current->next_result;
RFREE(client, last);
}
}
示例12: riack_free_mapred_result
void riack_free_mapred_result(riack_client* client, riack_mapred_response_list *result)
{
riack_mapred_response_list *current, *last;
current = result;
last = 0;
while (current) {
if (current->response.data_size > 0 && current->response.data) {
RFREE(client, current->response.data);
}
last = current;
current = current->next_result;
RFREE(client, last);
}
}
示例13: riack_free_search_result_p
void riack_free_search_result_p(riack_client* client, riack_search_result** search_result)
{
if (search_result && *search_result) {
size_t cnt = (*search_result)->document_count;
if (cnt > 0) {
size_t i;
for (i = 0; i < cnt; ++i) {
riack_free_search_document(client, &(*search_result)->documents[i]);
}
RFREE(client, (*search_result)->documents);
}
RFREE(client, *search_result);
*search_result = 0;
}
}
示例14: nr_turn_client_ctx_destroy
int
nr_turn_client_ctx_destroy(nr_turn_client_ctx **ctxp)
{
nr_turn_client_ctx *ctx;
if(!ctxp || !*ctxp)
return(0);
ctx=*ctxp;
*ctxp = 0;
if (ctx->label)
r_log(NR_LOG_TURN, LOG_DEBUG, "TURN(%s): destroy", ctx->label);
nr_turn_client_deallocate(ctx);
/* Cancel frees the rest of our data */
RFREE(ctx->label);
ctx->label = 0;
nr_turn_client_cancel(ctx);
RFREE(ctx->username);
ctx->username = 0;
r_data_destroy(&ctx->password);
RFREE(ctx->nonce);
ctx->nonce = 0;
RFREE(ctx->realm);
ctx->realm = 0;
/* Destroy the STUN client ctxs */
while (!STAILQ_EMPTY(&ctx->stun_ctxs)) {
nr_turn_stun_ctx *stun = STAILQ_FIRST(&ctx->stun_ctxs);
STAILQ_REMOVE_HEAD(&ctx->stun_ctxs, entry);
nr_turn_stun_ctx_destroy(&stun);
}
/* Destroy the permissions */
while (!STAILQ_EMPTY(&ctx->permissions)) {
nr_turn_permission *perm = STAILQ_FIRST(&ctx->permissions);
STAILQ_REMOVE_HEAD(&ctx->permissions, entry);
nr_turn_permission_destroy(&perm);
}
RFREE(ctx);
return(0);
}
示例15: riack_connect
int riack_connect(struct RIACK_CLIENT *client, const char* host, int port,
struct RIACK_CONNECTION_OPTIONS* options)
{
client->sockfd = sock_open(host, port);
if (client->sockfd > 0) {
if (client->host && host != client->host) {
RFREE(client, client->host);
}
if (host != client->host) {
client->host = (char*)RMALLOC(client, strlen(host)+1);
strcpy(client->host, host);
}
client->port = port;
if (options) {
client->options = *options;
if (!sock_set_timeouts(client->sockfd, options->recv_timeout_ms, options->send_timeout_ms)) {
sock_close(client->sockfd);
client->sockfd = -1;
// TODO set last error
}
}
return RIACK_SUCCESS;
}
return RIACK_ERROR_COMMUNICATION;
}