• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LOCAL_COPY函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: throw

//Android
void FSinOscUGenInternal::processBlock(bool& shouldDelete, const unsigned int blockID, const int channel) throw()
{	
	float* outputSamples = uGenOutput.getSampleData();
	float newFreq = *(inputs[Freq].processBlock(shouldDelete, blockID, channel));
	double y0;
	
	LOCAL_DECLARE(double, b1);
	LOCAL_DECLARE(double, y1);
	LOCAL_DECLARE(double, y2);
	
	if(newFreq != currentFreq)
	{
		currentFreq = newFreq;
		
		double initialPhase;
		
		if((1.0-abs(y1)) < 0.00001)
		{
			initialPhase = y1 > 0.0 ? piOverTwo : -piOverTwo;
		}
		else
		{
			initialPhase = asin(y1);
			// based on the trajectory predict which solution of asin(y1) is correct..
			if(y2 >= y1)
			{
				double piVersion = y1 > 0.0 ? pi : -pi;			
				initialPhase = piVersion - initialPhase;
			}
		}
		
		double w = currentFreq * twoPi * UGen::getReciprocalSampleRate();
		
		b1 = zap(2. * cos(w));
		y1 = zap(sin(initialPhase));
		y2 = zap(sin(initialPhase-w));
	}
	
	int numSamplesToProcess = uGenOutput.getBlockSize();
	for(int i = 0; i < numSamplesToProcess; ++i)
	{
		y0 = b1 * y1 - y2;
		outputSamples[i] = y0;// = b1 * y1 - y2; 
		y2 = y1; 
		y1 = y0;
	}
	
	y1 = zap(y1);
	y2 = zap(y2);
	LOCAL_COPY(b1);
	LOCAL_COPY(y1);
	LOCAL_COPY(y2);
}
开发者ID:kazu2012,项目名称:ofxUGen,代码行数:54,代码来源:ugen_FSinOsc.cpp


示例2: 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


示例3: 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


示例4: create_timer_ref

/*
 * create_timer_ref:  returns the lowest unused reference number for a timer
 * All refnums that are not already in use are valid.
 *
 * The user is allowed to use any string as a refnum, we dont really care.
 * Automatically assigned refnums (when the user doesnt specify one) will
 * always be one more than the highest pending refnum.
 *
 * "refnum_gets" must be REFNUM_MAX + 1 bytes by definition of API.
 */
static	int	create_timer_ref (const char *refnum_wanted, char *refnum_gets)
{
	Timer	*tmp;
	int 	refnum = 0;
	char	*refnum_want;

	/* Max of 10 characters. */
	refnum_want = LOCAL_COPY(refnum_wanted);
	if (strlen(refnum_want) > REFNUM_MAX)
		refnum_want[REFNUM_MAX] = 0;

	/* If the user doesnt care */
	if (*refnum_want == 0)
	{
		/* Find the lowest refnum available */
		for (tmp = PendingTimers; tmp; tmp = tmp->next)
		{
			if (refnum < my_atol(tmp->ref))
				refnum = my_atol(tmp->ref);
		}
		strlcpy(refnum_gets, ltoa(refnum+1), REFNUM_MAX + 1);
	}
	else
	{
		/* See if the refnum is available */
		if (get_timer(refnum_want))
			return -1;		/* Already in use */

		strlcpy(refnum_gets, refnum_want, REFNUM_MAX + 1);
	}

	return 0;
}
开发者ID:carriercomm,项目名称:epic5-1,代码行数:43,代码来源:timer.c


示例5: me_gcap

static int
me_gcap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
		int parc, const char *parv[])
{
	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))
		source_p->serv->caps |= capability_get(serv_capindex, s);

	return 0;
}
开发者ID:maxteufel,项目名称:charybdis,代码行数:25,代码来源:m_capab.c


示例6: do_notify

/*
 * do_notify: This simply goes through the notify list, sending out a WHOIS
 * for each person on it.  This uses the fancy whois stuff in whois.c to
 * figure things out.
 */
void do_notify(void)
{
	int	old_from_server = from_server;
	int	servnum;
	static	time_t		last_notify = 0;
	int		interval = get_int_var(NOTIFY_INTERVAL_VAR);
	time_t current_time = time(NULL);

	if (current_time < last_notify)
		last_notify = current_time;
	else if (!interval || interval > (current_time - last_notify))
		return;		/* Not yet */

	last_notify = current_time;

	if (!server_list_size() || !get_int_var(NOTIFY_VAR))
		return;
	for (servnum = 0; servnum < server_list_size(); servnum++)
	{
		if (is_server_connected(servnum) && !get_server_watch(servnum))
		{
			from_server = servnum;
			if (NOTIFY_LIST(servnum)->ison && *NOTIFY_LIST(servnum)->ison)
			{
				char *lame = LOCAL_COPY(NOTIFY_LIST(servnum)->ison);
				isonbase(lame, ison_notify);
			}
		}
	}
	from_server = old_from_server;
	return;
}
开发者ID:BitchX,项目名称:BitchX1.2,代码行数:37,代码来源:notify.c


示例7: create_timer_ref

/*
 * create_timer_ref:  returns the lowest unused reference number for a timer
 * All refnums that are not already in use are valid.
 *
 * The user is allowed to use any string as a refnum, we dont really care.
 * Automatically assigned refnums (when the user doesnt specify one) will
 * always be one more than the highest pending refnum.
 *
 * "refnum_gets" must be REFNUM_MAX + 1 bytes by definition of API.
 */
static	int	create_timer_ref (const char *refnum_wanted, char **refnum_gets)
{
	Timer	*tmp;
	int 	refnum = 0;
	char	*refnum_want;

	refnum_want = LOCAL_COPY(refnum_wanted);

	/* If the user doesnt care */
	if (*refnum_want == 0)
	{
		/* Find the lowest refnum available */
		for (tmp = PendingTimers; tmp; tmp = tmp->next)
		{
			if (refnum < my_atol(tmp->ref))
				refnum = my_atol(tmp->ref);
		}
		malloc_sprintf(refnum_gets, "%d", refnum + 1);
	}
	else
	{
		/* See if the refnum is available */
		if (get_timer(refnum_want))
			return -1;		/* Already in use */

		malloc_strcpy(refnum_gets, refnum_want);
	}

	return 0;
}
开发者ID:tcava,项目名称:bx2,代码行数:40,代码来源:timer.c


示例8: m_part

/*
** m_part
**      parv[0] = sender prefix
**      parv[1] = channel
**      parv[2] = reason
*/
static int
m_part(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	char *p, *name;
	char reason[REASONLEN + 1];
	char *s = LOCAL_COPY(parv[1]);

	reason[0] = '\0';

	if(parc > 2)
		strlcpy(reason, parv[2], sizeof(reason));

	name = strtoken(&p, s, ",");

	/* Finish the flood grace period... */
	if(MyClient(source_p) && !IsFloodDone(source_p))
		flood_endgrace(source_p);

	while (name)
	{
		part_one_client(client_p, source_p, name, reason);
		name = strtoken(&p, NULL, ",");
	}
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:31,代码来源:m_part.c


示例9: throw

void SchmidtUGenInternal::processBlock(bool& shouldDelete, const unsigned int blockID, const int channel) throw()
{
	int numSamplesToProcess = uGenOutput.getBlockSize();
	float* outputSamples = uGenOutput.getSampleData();
	float* inputSamples = inputs[Input].processBlock(shouldDelete, blockID, channel);
	float* loSamples = inputs[Lo].processBlock(shouldDelete, blockID, channel);
	float* hiSamples = inputs[Hi].processBlock(shouldDelete, blockID, channel);
	
	LOCAL_DECLARE(float, state);
	
	while(numSamplesToProcess--)
	{
		float input = *inputSamples++;
		float lo = *loSamples++;
		float hi = *hiSamples++;
		
		if(state > 0.f)
		{
			if(input < lo) state = 0.f;
		}
		else
		{
			if(input > hi) state = 1.f;
		}
		
		*outputSamples++ = state;
	}
	
	LOCAL_COPY(state);
}
开发者ID:kazu2012,项目名称:ofxUGen,代码行数:30,代码来源:ugen_Schmidt.cpp


示例10: m_quit

/*
** m_quit
**      parv[1] = comment
*/
static int
m_quit(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    char *comment = LOCAL_COPY((parc > 1 && parv[1]) ? parv[1] : client_p->name);
    char reason[REASONLEN + 1];

    source_p->flags |= FLAGS_NORMALEX;

    if(strlen(comment) > (size_t) REASONLEN)
        comment[REASONLEN] = '\0';

    strip_colour(comment);

    if(ConfigFileEntry.client_exit && comment[0]) {
        rb_snprintf(reason, sizeof(reason), "Quit: %s", comment);
        comment = reason;
    }

    if(!IsOper(source_p) && !EmptyString(ConfigFileEntry.static_quit)) {
        exit_client(client_p, source_p, source_p, ConfigFileEntry.static_quit);
        return 0;
    }

    if(!IsOper(source_p) &&
       (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time) >
       rb_current_time()) {
        exit_client(client_p, source_p, source_p, "Client Quit");
        return 0;
    }

    exit_client(client_p, source_p, source_p, comment);

    return 0;
}
开发者ID:Cloudxtreme,项目名称:elemental-ircd,代码行数:38,代码来源:m_quit.c


示例11: mr_capab

/*
 * mr_capab - CAPAB message handler
 *      parv[1] = space-separated list of capabilities
 *
 */
static int
mr_capab(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	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))
			client_p->localClient->caps |= capability_get(serv_capindex, s);
	}

	return 0;
}
开发者ID:maxteufel,项目名称:charybdis,代码行数:40,代码来源:m_capab.c


示例12: LOCAL_COPY

char	*make_string_var(const char *var_name)
{
	int	cnt,
		msv_index;
	char	*ret = NULL;
	char	*copy;
	
	copy = LOCAL_COPY(var_name);
	upper(copy);

	if ((find_fixed_array_item (irc_variable, sizeof(IrcVariable), NUMBER_OF_VARIABLES, copy, &cnt, &msv_index) == NULL))
		return NULL;
	if (cnt >= 0)
		return NULL;
	switch (irc_variable[msv_index].type)
	{
		case STR_TYPE_VAR:
			ret = m_strdup(irc_variable[msv_index].string);
			break;
		case INT_TYPE_VAR:
			ret = m_strdup(ltoa(irc_variable[msv_index].integer));
			break;
		case BOOL_TYPE_VAR:
			ret = m_strdup(var_settings[irc_variable[msv_index].integer]);
			break;
		case CHAR_TYPE_VAR:
			ret = m_dupchar(irc_variable[msv_index].integer);
			break;
	}
	return ret;
}
开发者ID:jnbek,项目名称:TekNap,代码行数:31,代码来源:vars.c


示例13: LOCAL_COPY

char *get_help_topic(char *args, int helpfunc)
{
char *new_comm = NULL;
int found = 0, i;
char *others = NULL;

	new_comm = LOCAL_COPY(args);

	for (i = 0; helpfunc ? script_help[i] : help_index[i]; i++)
	{
		if (!my_strnicmp(helpfunc?script_help[i]->title:help_index[i]->title, new_comm, strlen(new_comm)))
		{
			int j;
			char *text = NULL;
			if (found++)
			{
				m_s3cat(&others, " , ", helpfunc?script_help[i]->title:help_index[i]->title);
				continue;
			}
			if (args && *args && do_hook(HELPTOPIC_LIST, "%s", args))
				put_it("%s",convert_output_format("$G \002$0\002: Help on Topic: \002$1\002", version, args));
			for (j = 0; ; j++)
			{
				if (helpfunc && (script_help[i] && script_help[i]->contents[j]))
					text = script_help[i]->contents[j];
				else if (!helpfunc && (help_index[i] && help_index[i]->contents[j]))
					text = help_index[i]->contents[j];
				else 
					break;

				if (text && do_hook(HELPSUBJECT_LIST, "%s %s", new_comm, text))
				{
					in_chelp++;
					put_it("%s", convert_output_format(text, NULL));
					in_chelp--;
				}
			}		
			text = helpfunc ?script_help[i]->relates:help_index[i]->relates;
			if (text && do_hook(HELPTOPIC_LIST, "%s", text))
				put_it("%s", convert_output_format(text, NULL));
		}
		else if (found)
			break;
	}
	if (!found)
	{
		if (do_hook(HELPTOPIC_LIST, "%s", args))
			bitchsay("No help on %s", args);
	}

	if (others && found)
	{
		if (do_hook(HELPTOPIC_LIST, "%d %s", found, others))
			put_it("Other %d subjects: %s", found - 1, others);
	}
	new_free(&others);
	if (helpfunc)
		return m_strdup(empty_string);
	return NULL;
}
开发者ID:nikolatesla,项目名称:BitchXMPP,代码行数:60,代码来源:chelp.c


示例14: m_ison

static int
m_ison(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	struct Client *target_p;
	char *nick;
	char *p;
	char buf[IRCD_BUFSIZE];
	int i;

	memset(buf, 0, sizeof(buf));

	for(i = 1; i < parc; i++)
	{
		char *cs = LOCAL_COPY(parv[i]);
		for(nick = rb_strtok_r(cs, " ", &p); nick; nick = rb_strtok_r(NULL, " ", &p))
		{
			target_p = find_named_client(nick);

			if(target_p != NULL)
			{
				rb_strlcat(buf, target_p->name, sizeof(buf));
				rb_strlcat(buf, " ", sizeof(buf));
			}
		}
	}
	sendto_one_numeric(source_p, s_RPL(RPL_ISON), buf);
	return 0;

}
开发者ID:thors,项目名称:ircd-ratbox,代码行数:29,代码来源:m_ison.c


示例15: m_ison

/*
 * m_ison added by Darren Reed 13/8/91 to act as an efficent user indicator
 * with respect to cpu/bandwidth used. Implemented for NOTIFY feature in
 * clients. Designed to reduce number of whois requests. Can process
 * nicknames in batches as long as the maximum buffer length.
 *
 * format:
 * ISON :nicklist
 */
static int
m_ison(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	struct Client *target_p;
	char *nick;
	char *p;
	char *current_insert_point, *current_insert_point2;
	int len;
	int i;
	int done = 0;

	current_insert_point2 = buf2;
	*buf2 = '\0';

	rb_sprintf(buf, form_str(RPL_ISON), me.name, source_p->name);
	len = strlen(buf);
	current_insert_point = buf + len;

	/* rfc1489 is ambigious about how to handle ISON
	 * this should handle both interpretations.
	 */
	for(i = 1; i < parc; i++)
	{
		char *cs = LOCAL_COPY(parv[i]);
		for(nick = rb_strtok_r(cs, " ", &p); nick; nick = rb_strtok_r(NULL, " ", &p))
		{
			target_p = find_named_client(nick);

			if(target_p != NULL)
			{
				len = strlen(target_p->name);
				if((current_insert_point + (len + 5)) < (buf + sizeof(buf)))
				{
					memcpy(current_insert_point, target_p->name, len);
					current_insert_point += len;
					*current_insert_point++ = ' ';
				}
				else
				{
					done = 1;
					break;
				}
			}
		}
		if(done)
			break;
	}

	/*  current_insert_point--;
	 *  Do NOT take out the trailing space, it breaks ircII
	 *  --Rodder */

	*current_insert_point = '\0';
	*current_insert_point2 = '\0';

	sendto_one_buffer(source_p, buf);

	return 0;
}
开发者ID:asterIRC,项目名称:ircd-ratbox-ircnet,代码行数:68,代码来源:m_ison.c


示例16: me_forcenick

/*
 * me_forcenick
 *      parv[1] = forcenick victim
 *      parv[2] = new nickname 
 */
static int
me_forcenick(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	struct Client *target_p, *exist_p;
	const char *user;
	const char *newnick;

	user = parv[1];

	/* We're supposed to drop servers over protocol violations, but shit happens... */

	if(EmptyString(parv[2]))
		return 0;
	else
	{
		char *s;
		s = LOCAL_COPY(parv[2]);
		if(strlen(s) > (size_t) NICKLEN)
			s[NICKLEN] = '\0';
		newnick = s;
	}

	if(!clean_nick(newnick))
		return 0;

	if((target_p = find_person(user)) == NULL)
		return 0;

	if(IsServer(target_p) || IsMe(target_p))
		return 0;

	if(!MyClient(target_p) && !IsOperGlobalForce(source_p))
		return 0;

	if((exist_p = find_person(newnick)) != NULL)
	{
		/* Could just be a case shift */
		if(irccmp(target_p->name, newnick))
			return 0;
		/* If it's the same nick, fuck it */
		else if(!strcmp(target_p->name, newnick))
			return 0;
	}

	ilog(L_MAIN, "FORCENICK called for [%s] by %s!%[email protected]%s",
	     target_p->name, source_p->name, source_p->username, source_p->host);

	if(!MyClient(target_p))
	{
		struct Client *cptr = target_p->servptr;
		sendto_one(cptr, ":%s ENCAP %s FORCENICK %s :%s", 
				 get_id(source_p, cptr), cptr->name, get_id(target_p, cptr), newnick);
		return 0;
	}
	
	change_nick(target_p, newnick);

	return 0;
}
开发者ID:fgt-transit,项目名称:aFailIRCd,代码行数:64,代码来源:m_forcenick.c


示例17: m_cycle

static int
m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    char *p, *name;
    char *s = LOCAL_COPY(parv[1]);
    struct Channel *chptr;
    struct membership *msptr;

    name = rb_strtok_r(s, ",", &p);

    /* Finish the flood grace period... */
    if(MyClient(source_p) && !IsFloodDone(source_p))
        flood_endgrace(source_p);

    while(name) {
        if((chptr = find_channel(name)) == NULL) {
            sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
            return 0;
        }

        msptr = find_channel_membership(chptr, source_p);
        if(msptr == NULL) {
            sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
            return 0;
        }

        if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
            check_spambot_warning(source_p, NULL);

        if((is_any_op(msptr) || !MyConnect(source_p) ||
            ((can_send(chptr, source_p, msptr) > 0 &&
              (source_p->localClient->firsttime +
               ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) {
            sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                          ":%s PART %s :Cycling", use_id(source_p), chptr->chname);
            sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :Cycling",
                                 source_p->name, source_p->username,
                                 source_p->host, chptr->chname);
        } else {
            sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
                          ":%s PART %s", use_id(source_p), chptr->chname);
            sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s",
                                 source_p->name, source_p->username,
                                 source_p->host, chptr->chname);
        }

        remove_user_from_channel(msptr);

        chptr = NULL;
        msptr = NULL;

        name = rb_strtok_r(NULL, ",", &p);
    }

    user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL);

    return 0;
}
开发者ID:Cloudxtreme,项目名称:elemental-ircd,代码行数:58,代码来源:m_cycle.c


示例18: ms_quit

/*
** ms_quit
**      parv[1] = comment
*/
static void
ms_quit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	char *comment = LOCAL_COPY((parc > 1 && parv[1]) ? parv[1] : client_p->name);

	source_p->flags |= FLAGS_NORMALEX;
	if(strlen(comment) > (size_t) REASONLEN)
		comment[REASONLEN] = '\0';

	exit_client(client_p, source_p, source_p, comment);
}
开发者ID:KeiroD,项目名称:charybdis,代码行数:15,代码来源:m_quit.c


示例19: create_timer_ref

/*
 * create_timer_ref:  returns the lowest unused reference number for a timer
 * All refnums that are not already in use are valid.
 *
 * The user is allowed to use any string as a refnum, we dont really care.
 * Automatically assigned refnums (when the user doesnt specify one) will
 * always be one more than the highest pending refnum.
 *
 * "refnum_gets" must be REFNUM_MAX + 1 bytes by definition of API.
 */
static	int	create_timer_ref (const char *refnum_wanted, char **refnum_gets)
{
	Timer	*tmp;
	int 	refnum = 0;
	char	*refnum_want;
	int	i, pts;

	refnum_want = LOCAL_COPY(refnum_wanted);

	/* If the user doesnt care */
	if (*refnum_want == 0)
	{
		/* So ... we count the number of times that exist. */
		for (pts = 0, tmp = PendingTimers; tmp; tmp = tmp->next)
			pts++;

		/* 
		 * Now, for all the numbers (0 .. [timer count + 1]), 
		 * at least one of those numbers *has* to be available,
		 */ 
		for (i = 0; i <= pts + 1; i++)
		{
			/* Are any timers named 'i'? */
			for (tmp = PendingTimers; tmp; tmp = tmp->next)
			{
				if (!is_number(tmp->ref))
					continue;
				if (i == my_atol(tmp->ref))
					break;
			}

			/* 
			 * If 'tmp' is null, then we didn't find a refnum 'i'.
			 * So 'i' is our winner!
			 */
			if (tmp == NULL)
			{
				malloc_sprintf(refnum_gets, "%d", i);
				break;
			}
		}
	}
	else
	{
		/* See if the refnum is available */
		if (get_timer(refnum_want))
			return -1;		/* Already in use */

		malloc_strcpy(refnum_gets, refnum_want);
	}

	return 0;
}
开发者ID:ailin-nemui,项目名称:epic5,代码行数:63,代码来源:timer.c


示例20: add_user_end

static void	add_user_end (int refnum, const char *from, const char *comm, const char **ArgList)
{
	char *	copy;
	char *	channel;

	if (!ArgList[0])
		{ rfc1459_odd(from, "*", ArgList); return; }

	copy = LOCAL_COPY(ArgList[0]);
	channel = next_arg(copy, &copy);
	channel_not_waiting(channel, refnum);
}
开发者ID:carriercomm,项目名称:epic4,代码行数:12,代码来源:numbers.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOCAL_DEBUG_OUT函数代码示例发布时间:2022-05-30
下一篇:
C++ LOCAL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap