当前位置: 首页>>代码示例>>C++>>正文


C++ rb_free函数代码示例

本文整理汇总了C++中rb_free函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_free函数的具体用法?C++ rb_free怎么用?C++ rb_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rb_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rb_ssl_tryaccept

static void
rb_ssl_tryaccept(rb_fde_t *F, void *data)
{
	int ret;
	struct acceptdata *ad;

	lrb_assert(F->accept != NULL);

	ret = do_ssl_handshake(F, rb_ssl_tryaccept, NULL);

	/* do_ssl_handshake does the rb_setselect */
	if(ret == 0)
		return;

	ad = F->accept;
	F->accept = NULL;
	rb_settimeout(F, 0, NULL, NULL);
	rb_setselect(F, RB_SELECT_READ | RB_SELECT_WRITE, NULL, NULL);

	if(ret > 0)
		ad->callback(F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
	else
		ad->callback(F, RB_ERROR_SSL, NULL, 0, ad->data);

	rb_free(ad);
}
开发者ID:viatsko,项目名称:charybdis,代码行数:26,代码来源:gnutls.c

示例2: free_listener

void
free_listener(struct Listener *listener)
{
	s_assert(NULL != listener);
	if(listener == NULL)
		return;
	/*
	 * remove from listener list
	 */
	if(listener == ListenerPollList)
		ListenerPollList = listener->next;
	else
	{
		struct Listener *prev = ListenerPollList;
		for (; prev; prev = prev->next)
		{
			if(listener == prev->next)
			{
				prev->next = listener->next;
				break;
			}
		}
	}

	/* free */
	rb_free(listener);
}
开发者ID:Nilkanth1999,项目名称:sIRCd,代码行数:27,代码来源:listener.c

示例3: mr_user

/* mr_user()
 *      parv[1] = username (login name, account)
 *      parv[2] = client host name (ignored)
 *      parv[3] = server host name (ignored)
 *      parv[4] = users gecos
 */
static int
mr_user(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	static char buf[BUFSIZE];
	char *p;

	if (strlen(client_p->id) == 3)
	{
		exit_client(client_p, client_p, client_p, "Mixing client and server protocol");
		return 0;
	}

	if(source_p->flags & FLAGS_SENTUSER)
		return 0;

	if((p = strchr(parv[1], '@')))
		*p = '\0';

	rb_snprintf(buf, sizeof(buf), "%s %s", parv[2], parv[3]);
	rb_free(source_p->localClient->fullcaps);
	source_p->localClient->fullcaps = rb_strdup(buf);

	do_local_user(client_p, source_p, parv[1], parv[4]);
	return 0;
}
开发者ID:ChatLounge,项目名称:ChatIRCd,代码行数:31,代码来源:m_user.c

示例4: mr_capab

/*
 * mr_capab - CAPAB message handler
 *      parv[1] = space-separated list of capabilities
 *
 */
static int
mr_capab(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	struct Capability *cap;
	int i;
	char *p;
	char *s;
	/* ummm, this shouldn't happen. Could argue this should be logged etc. */
	if (client_p->localClient == NULL)
		return 0;
	if (client_p->user)
		return 0;
	/* CAP_TS6 is set in PASS, so is valid.. */
	if ((client_p->localClient->caps & ~CAP_TS6) != 0) {
		exit_client(client_p, client_p, client_p, "CAPAB received twice");
		return 0;
	} else
		client_p->localClient->caps |= CAP_CAP;
	rb_free(client_p->localClient->fullcaps);
	client_p->localClient->fullcaps = rb_strdup(parv[1]);
	for (i = 1; i < parc; i++) {
		char *t = LOCAL_COPY(parv[i]);
		for (s = rb_strtok_r(t, " ", &p); s; s = rb_strtok_r(NULL, " ", &p)) {
			for (cap = captab; cap->name; cap++) {
				if (!irccmp(cap->name, s)) {
					client_p->localClient->caps |= cap->cap;
					break;
				}
			}
		}
	}
	return 0;
}
开发者ID:Codyle,项目名称:elemental-ircd,代码行数:38,代码来源:m_capab.c

示例5: me_gcap

static int
me_gcap(struct Client *client_p, struct Client *source_p,
        int parc, const char *parv[])
{
	struct Capability *cap;
	char *t = LOCAL_COPY(parv[1]);
	char *s;
	char *p;
	if (!IsServer(source_p))
		return 0;
	/* already had GCAPAB?! */
	if (!EmptyString(source_p->serv->fullcaps)) {
		source_p->serv->caps = 0;
		rb_free(source_p->serv->fullcaps);
	}
	source_p->serv->fullcaps = rb_strdup(parv[1]);
	for (s = rb_strtok_r(t, " ", &p); s; s = rb_strtok_r(NULL, " ", &p)) {
		for (cap = captab; cap->name; cap++) {
			if (!irccmp(cap->name, s)) {
				source_p->serv->caps |= cap->cap;
				break;
			}
		}
	}
	return 0;
}
开发者ID:Codyle,项目名称:elemental-ircd,代码行数:26,代码来源:m_capab.c

示例6: rb_ssl_accept_setup

void
rb_ssl_accept_setup(rb_fde_t *F, rb_fde_t *new_F, struct sockaddr *st, int addrlen)
{
	new_F->type |= RB_FD_SSL;
	new_F->ssl = rb_malloc(sizeof(gnutls_session_t));
	new_F->accept = rb_malloc(sizeof(struct acceptdata));

	new_F->accept->callback = F->accept->callback;
	new_F->accept->data = F->accept->data;
	rb_settimeout(new_F, 10, rb_ssl_timeout, NULL);
	memcpy(&new_F->accept->S, st, addrlen);
	new_F->accept->addrlen = addrlen;

	gnutls_init((gnutls_session_t *) new_F->ssl, GNUTLS_SERVER);
	gnutls_set_default_priority(SSL_P(new_F));
	gnutls_credentials_set(SSL_P(new_F), GNUTLS_CRD_CERTIFICATE, x509);
	gnutls_dh_set_prime_bits(SSL_P(new_F), 1024);
	gnutls_transport_set_ptr(SSL_P(new_F), (gnutls_transport_ptr_t) (long int)rb_get_fd(new_F));
	gnutls_certificate_server_set_request(SSL_P(new_F), GNUTLS_CERT_REQUEST);
	gnutls_priority_set(SSL_P(F), default_priority);

	if(do_ssl_handshake(F, rb_ssl_tryaccept, NULL))
	{
		struct acceptdata *ad = F->accept;
		F->accept = NULL;
		ad->callback(F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
		rb_free(ad);
	}
}
开发者ID:viatsko,项目名称:charybdis,代码行数:29,代码来源:gnutls.c

示例7: rb_ssl_start_accepted

void
rb_ssl_start_accepted(rb_fde_t *new_F, ACCB * cb, void *data, int timeout)
{
	gnutls_session_t *ssl;
	new_F->type |= RB_FD_SSL;
	ssl = new_F->ssl = rb_malloc(sizeof(gnutls_session_t));
	new_F->accept = rb_malloc(sizeof(struct acceptdata));

	new_F->accept->callback = cb;
	new_F->accept->data = data;
	rb_settimeout(new_F, timeout, rb_ssl_timeout, NULL);

	new_F->accept->addrlen = 0;

	gnutls_init(ssl, GNUTLS_SERVER);
	gnutls_set_default_priority(*ssl);
	gnutls_credentials_set(*ssl, GNUTLS_CRD_CERTIFICATE, x509);
	gnutls_dh_set_prime_bits(*ssl, 1024);
	gnutls_transport_set_ptr(*ssl, (gnutls_transport_ptr_t) (long int)new_F->fd);
	gnutls_certificate_server_set_request(*ssl, GNUTLS_CERT_REQUEST);
	gnutls_priority_set(*ssl, default_priority);

	if(do_ssl_handshake(new_F, rb_ssl_tryaccept, NULL))
	{
		struct acceptdata *ad = new_F->accept;
		new_F->accept = NULL;
		ad->callback(new_F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
		rb_free(ad);
	}

}
开发者ID:viatsko,项目名称:charybdis,代码行数:31,代码来源:gnutls.c

示例8: operhash_delete

void
operhash_delete(const char *name)
{
	struct operhash_entry *ohash = irc_radixtree_retrieve(operhash_tree, name);

	if (ohash != NULL)
		rb_free(ohash);
}
开发者ID:dwfreed,项目名称:charybdis,代码行数:8,代码来源:operhash.c

示例9: vorbis_decoder_close

void
vorbis_decoder_close(decoder_t * dec) {

	vorbis_pdata_t * pd = (vorbis_pdata_t *)dec->pdata;

	ov_clear(&(pd->vf));
	rb_free(pd->rb);
}
开发者ID:alex1818,项目名称:aqualung,代码行数:8,代码来源:dec_vorbis.c

示例10: rb_ssl_connect_realcb

static void
rb_ssl_connect_realcb(rb_fde_t *F, int status, struct ssl_connect *sconn)
{
	F->connect->callback = sconn->callback;
	F->connect->data = sconn->data;
	rb_free(sconn);
	rb_connect_callback(F, status);
}
开发者ID:Macs,项目名称:NeoIRCd,代码行数:8,代码来源:openssl.c

示例11: do_modload

static void
do_modload(struct Client *source_p, const char *module)
{
	char *m_bn = rb_basename(module);
	int origin;

	if(findmodule_byname(m_bn) != -1)
	{
		sendto_one_notice(source_p, ":Module %s is already loaded", m_bn);
		rb_free(m_bn);
		return;
	}

	origin = strcmp(module, m_bn) == 0 ? MAPI_ORIGIN_CORE : MAPI_ORIGIN_EXTENSION;
	load_one_module(module, origin, false);

	rb_free(m_bn);
}
开发者ID:kleopatra999,项目名称:charybdis,代码行数:18,代码来源:m_modules.c

示例12: rb_sigio_unsched_event

void
rb_sigio_unsched_event(struct ev_entry *event)
{
    if(can_do_event <= 0)
        return;
    timer_delete(*((timer_t *) event->comm_ptr));
    rb_free(event->comm_ptr);
    event->comm_ptr = NULL;
}
开发者ID:TwinUsers,项目名称:ircd-kaffe,代码行数:9,代码来源:sigio.c

示例13: generate_challenge

static int
generate_challenge(char **r_challenge, char **r_response, RSA * rsa)
{
	SHA_CTX ctx;
	unsigned char secret[CHALLENGE_SECRET_LENGTH], *tmp;
	unsigned long length;
	unsigned long e = 0;
	unsigned long cnt = 0;
	int ret;

	if(!rsa)
		return -1;
	if(rb_get_random(secret, CHALLENGE_SECRET_LENGTH))
	{
		SHA1_Init(&ctx);
		SHA1_Update(&ctx, (uint8_t *)secret, CHALLENGE_SECRET_LENGTH);
		*r_response = malloc(SHA_DIGEST_LENGTH);
		SHA1_Final((uint8_t *)*r_response, &ctx);

		length = RSA_size(rsa);
		tmp = rb_malloc(length);
		ret = RSA_public_encrypt(CHALLENGE_SECRET_LENGTH, secret, tmp, rsa, RSA_PKCS1_OAEP_PADDING);

		if(ret >= 0)
		{
			*r_challenge = (char *)rb_base64_encode(tmp, ret);
			rb_free(tmp);
			return 0;
		}

		rb_free(tmp);
		rb_free(*r_response);
		*r_response = NULL;
	}

	ERR_load_crypto_strings();
	while ((cnt < 100) && (e = ERR_get_error()))
	{
		ilog(L_MAIN, "SSL error: %s", ERR_error_string(e, 0));
		cnt++;
	}

	return (-1);
}
开发者ID:AbstractBeliefs,项目名称:charybdis,代码行数:44,代码来源:m_challenge.c

示例14: speex_dec_close

void
speex_dec_close(decoder_t * dec) {

	speex_pdata_t * pd = (speex_pdata_t *)dec->pdata;

	oggz_close(pd->oggz);
	speex_bits_destroy(&(pd->bits));
        speex_decoder_destroy(pd->decoder);
	rb_free(pd->rb);
}
开发者ID:alex1818,项目名称:aqualung,代码行数:10,代码来源:dec_speex.c

示例15: rb_helper_close

void
rb_helper_close(rb_helper *helper)
{
	if(helper == NULL)
		return;
	rb_kill(helper->pid, SIGKILL);
	rb_close(helper->ifd);
	rb_close(helper->ofd);
	rb_free(helper);
}
开发者ID:awilfox,项目名称:charybdis,代码行数:10,代码来源:helper.c


注:本文中的rb_free函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。