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

C++ Q_free函数代码示例

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

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



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

示例1: StatsGrid_Remove

void StatsGrid_Remove(stats_weight_grid_t **grid)
{
	int row;

	// Nothing to remove.
	if((*grid) == NULL)
	{
		return;
	}

	// Free all the rows.
	if((*grid)->cells != NULL)
	{
		for(row = 0; row < (*grid)->row_count; row++)
		{
			// Make sure it hasn't already been freed.
			if((*grid)->cells[row] != NULL)
			{
				Q_free((*grid)->cells[row]);
			}
		}
	}

	// Free all columns.
	Q_free((*grid)->cells);

	// Free the grid itself.
	Q_free((*grid));
}
开发者ID:jite,项目名称:jquake,代码行数:29,代码来源:stats_grid.c


示例2: Q_malloc

// strip spaces multiple spaces from in-between words
char *XSD_StripSpaces (char *str)
{
    char *buf, *ret;
    unsigned int p = 0, q = 0;

    if (str == NULL)
        return str;

    buf = (char *) Q_malloc(strlen(str)+1);
    for (p=0; p < strlen(str); p++)
    {
        if (XSD_IsSpace(str[p]))
        {
            if (q == 0  ||  XSD_IsSpace(buf[q-1]))
                ;
            else
                buf[q++] = ' ';
        }
        else
            buf[q++] = str[p];
    }

    // strip spaces from the end
    while (q > 0  &&  XSD_IsSpace(buf[q-1]))
        q--;
    buf[q] = 0;

    ret = (char *) Q_strdup(buf);
    Q_free(buf);
    Q_free(str);
    return ret;
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:33,代码来源:xsd.c


示例3: Q_free

mvd_clock_t *MVD_ClockList_Remove(mvd_clock_t *item)
{
	mvd_clock_t *ret = NULL;

	if (item == mvd_clocklist) {
		mvd_clocklist = item->next;
		if (mvd_clocklist) {
			mvd_clocklist->prev = NULL;
		}
		Q_free(item);
		return mvd_clocklist;
	}

	ret = item->next;
	// item->prev is not null
	if (item->next) {
		item->next->prev = item->prev;
		item->prev->next = item->next;
	}
	else {
		item->prev->next = NULL;
	}
	Q_free(item);
	return ret;
}
开发者ID:DavidWiberg,项目名称:ezquake-source,代码行数:25,代码来源:mvd_utils.c


示例4: funcmp

// compares two fun strings
int funcmp(const char *s1, const char *s2)
{
    char *t1, *t2;
    int ret;

    if (s1 == NULL  &&  s2 == NULL)
        return 0;

    if (s1 == NULL)
        return -1;

    if (s2 == NULL)
        return 1;

    t1 = Q_strdup(s1);
    t2 = Q_strdup(s2);

    FunToSort(t1);
    FunToSort(t2);

    ret = strcmp(t1, t2);

    Q_free(t1);
    Q_free(t2);

    return ret;
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:28,代码来源:utils.c


示例5: MP3_WINAMP_CachePlaylistFlush

static void MP3_WINAMP_CachePlaylistFlush(void) {
	int i;
	for (i = 0; i < WINAMP_Playlist_nelms; i++)
		Q_free(WINAMP_Playlist[i]);

	Q_free(WINAMP_Playlist);
}
开发者ID:jogi1,项目名称:camquake,代码行数:7,代码来源:mp3_winamp.c


示例6: Util_F_Match

qbool Util_F_Match (const char *_msg, char *f_request) {
	int offset, i, status, flags;
	char *s, *msg;

	msg = Q_strdup(_msg);
	flags = TP_CategorizeMessage(msg, &offset);

	if (flags != 1 && flags != 4)
		return false;

	for (i = 0, s = msg + offset; i < strlen(s); i++)
		s[i] = s[i] & ~128;		

	if (strstr(s, f_request) != s) {
		Q_free(msg);
		return false;
	}
	status = 0;
	for (s += strlen(f_request); *s; s++) {
		if (isdigit(*s) && status <= 1) {
			status = 1;
		} else if (isspace(*s)) {
			status = (status == 1) ? 2 : status;
		} else {
			Q_free(msg);			
			return false;
		}
	}
	Q_free(msg);
	return true;
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:31,代码来源:utils.c


示例7: R_Bloom_InitTextures

void R_Bloom_InitTextures( void )
{
	unsigned char *data;
	int maxtexsize;
	size_t size;

	// Find closer power of 2 to screen size.
	for (screen_texture_width = 1;  screen_texture_width  < glwidth;  screen_texture_width *= 2);
	for (screen_texture_height = 1; screen_texture_height < glheight; screen_texture_height *= 2);

    // Disable blooms if we can't handle a texture of that size.
	glGetIntegerv (GL_MAX_TEXTURE_SIZE, &maxtexsize);
	if (screen_texture_width > maxtexsize || screen_texture_height > maxtexsize)
	{
		screen_texture_width = screen_texture_height = 0;
		Cvar_SetValue (&r_bloom, 0);
		Com_Printf ("WARNING: 'R_InitBloomScreenTexture' too high resolution for Light Bloom. Effect disabled\n");
		return;
	}

	// Init the screen texture.
	size = screen_texture_width * screen_texture_height * sizeof (int);
	data = Q_malloc (size);
	memset (data, 255, size);
	//r_bloomscreentexture = GL_LoadTexture ( "***r_screenbackuptexture***", screen_texture_width, screen_texture_height, data, 0, 4); // false, false, 4);
	
	if (!r_bloomscreentexture)
		r_bloomscreentexture = texture_extension_number++;

	GL_Bind (r_bloomscreentexture);
	glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, screen_texture_width, screen_texture_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
	glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

	Q_free (data);

	// Validate bloom size and init the bloom effect texture.
	R_Bloom_InitEffectTexture();

	// If screensize is more than 2x the bloom effect texture, set up for stepped downsampling.
	r_bloomdownsamplingtexture = 0;
	r_screendownsamplingtexture_size = 0;
	if( glwidth > (BLOOM_SIZE * 2) && !r_bloom_fast_sample.value )
	{
		r_screendownsamplingtexture_size = (int)(BLOOM_SIZE * 2);
		data = Q_calloc (r_screendownsamplingtexture_size * r_screendownsamplingtexture_size, sizeof (int));
		r_bloomdownsamplingtexture = GL_LoadTexture ( "***r_bloomdownsamplingtexture***", r_screendownsamplingtexture_size, r_screendownsamplingtexture_size, data, 0, 4);
		Q_free (data);
	}

	// Init the screen backup texture.
	if (r_screendownsamplingtexture_size)
		R_Bloom_InitBackUpTexture (r_screendownsamplingtexture_size, r_screendownsamplingtexture_size);
	else
		R_Bloom_InitBackUpTexture (BLOOM_SIZE, BLOOM_SIZE);
}
开发者ID:jogi1,项目名称:camquake,代码行数:56,代码来源:gl_bloom.c


示例8: ClipWinding

/*
=================
ChopWinding

Returns the fragment of in that is on the front side
of the cliping plane.  The original is freed.
=================
*/
winding_t	*ChopWinding (winding_t *in, vec3_t normal, vec_t dist)
{
	winding_t	*f, *b;

	ClipWinding (in, normal, dist, &f, &b);
	Q_free (in);
	if (b)
		Q_free (b);
	return f;
}
开发者ID:atphalix,项目名称:eviltoys,代码行数:18,代码来源:polylib.c


示例9: QTVList_Entry_Destroy

void QTVList_Entry_Destroy(sb_qtventry_t *entry)
{
	while (entry->players) {
		sb_qtvplayer_t *next = entry->players->next;
		Q_free(entry->players);
		entry->players = next;
	}

	Q_free(entry);
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:10,代码来源:EX_browser_qtvlist.c


示例10: FreePage

static void FreePage(CPageViewer_page_t *page)
{
    FreePageRendered(page);
    if (page->url)
        Q_free(page->url);
    if (page->doc)
        XSD_FreeDocument((xml_t *)page->doc);
    Q_free(page);
    return;
}
开发者ID:AAS,项目名称:ezquake-source,代码行数:10,代码来源:Ctrl_PageViewer.c


示例11: SList_Set

void SList_Set (int i, char *addr, char *desc) {
	if (i >= MAX_SERVER_LIST || i < 0)
		Sys_Error("SList_Switch: Bad index %d", i);

	if (slist[i].server)
		Q_free(slist[i].server);
	if (slist[i].description)
		Q_free(slist[i].description);

	slist[i].server = Q_strdup (addr);
	slist[i].description = Q_strdup (desc);
}
开发者ID:DavidWiberg,项目名称:ezquake-source,代码行数:12,代码来源:cl_slist.c


示例12: CmdArgs_Clear

void CmdArgs_Clear(void)
{
	int i;

	for (i = 0; i < cmdargs.mvd_files_count; i++)
	{
		Q_free(cmdargs.mvd_files[i]);
	}

	Q_free(cmdargs.template_file);
	Q_free(cmdargs.frag_file);
}
开发者ID:JoakimSoderberg,项目名称:mvdparser,代码行数:12,代码来源:main.c


示例13: IN_RawInput_DeInit

void IN_RawInput_DeInit(void)
{
	if (rawmicecount < 1)
		return;

	IN_RawInput_DeRegister();
	Q_free(rawmice);
	Q_free(raw);

	// dealloc mouse structure
	rawmicecount = 0;
}
开发者ID:jite,项目名称:jquake,代码行数:12,代码来源:in_win.c


示例14: Cmd_StuffCmds_f

/*
===============
Cmd_StuffCmds_f

Adds command line parameters as script statements
Commands lead with a +, and continue until a - or another +
quake +prog jctest.qp +cmd amlev1
quake -nosound +cmd amlev1
===============
*/
void Cmd_StuffCmds_f (void)
{
	int i, j;
	int s;
	char *text, *build, c;

	// build the combined string to parse from
	s = 0;
	for (i = 1; i < com_argc; i++)
		s += strlen (com_argv[i]) + 1;

	if (!s)
		return;

	text = (char *) Q_malloc (s+1);
	text[0] = 0;
	for (i = 1; i < com_argc; i++)
	{
		strlcat (text, com_argv[i], s + 1);
		if (i != com_argc-1)
			strlcat (text, " ", s + 1);
	}

	// pull out the commands
	build = (char *) Q_malloc (s+1);
	build[0] = 0;

	for (i=0 ; i<s-1 ; i++)
	{
		if (text[i] == '+')
		{
			i++;

			for (j=i ; (text[j] != '+') && (text[j] != '-') && (text[j] != 0) ; j++)
				;

			c = text[j];
			text[j] = 0;

			strlcat (build, text + i, s + 1);
			strlcat (build, "\n", s + 1);
			text[j] = c;
			i = j-1;
		}
	}

	if (build[0])
		Cbuf_AddText (build);

	Q_free (text);
	Q_free (build);
}
开发者ID:QuakePhil,项目名称:mvdsv,代码行数:62,代码来源:cmd.c


示例15: Reset_Source

void Reset_Source(source_data *s)
{
    int i;
    if (s->servers != NULL)
    {
        for (i=0; i < s->serversn; i++)
            Q_free(s->servers[i]);
        Q_free(s->servers);
    }
    s->serversn = 0;
    s->last_update.wYear = 0;
    //s->name[0] = 0;
}
开发者ID:imanex,项目名称:ezquake-source,代码行数:13,代码来源:EX_browser_sources.c


示例16: FSPAK_ClosePath

static void FSPAK_ClosePath(void *handle)
{
	pack_t *pak = handle;

	pak->references--;
	if (pak->references > 0)
		return;	//not free yet

	VFS_CLOSE (pak->handle);
	if (pak->files)
		Q_free(pak->files);
	Q_free(pak);
}
开发者ID:jite,项目名称:jquake,代码行数:13,代码来源:vfs_pak.c


示例17: Q_normalizetext

static char *VX_SkipCommonPrefix(int player)
{
	size_t skip;
	char *prefixes, *prefix, *name;

	skip = 0;
	prefixes = Q_normalizetext(Q_strdup(amf_tracker_name_prefixes.string));
	prefix = strtok(prefixes, " ");
	name = Q_normalizetext(Q_strdup(cl.players[player].name));

	if (prefix == NULL)  {
		// no prefixes defined by the user, search all players and remove the commont prefix
		size_t i;
		int j;
		unsigned players_left;

		players_left = 0xFFFF;
		players_left &= ~(1 << player);

		for (i = 0; i < strlen(cl.players[player].name); i++) {
			for (j = 0; j < MAX_CLIENTS; j++) {
				if ((players_left & (1 << j)) == 0)
					continue;
				if (cl.players[j].spectator)
					players_left &= ~(1 << j);
				if (strlen(cl.players[j].name) < i + 1 || cl.players[j].name[i] != cl.players[player].name[i])
					players_left &= ~(1 << j);
			}
			if (players_left == 0)
				break;
		}

		skip = i;

		if (skip == strlen(cl.players[player].name))
			skip = 0;
	} else {
		while (prefix != NULL) {
			if (strlen(name) > strlen(prefix) && strncasecmp(prefix, name, strlen(prefix)) == 0) {
				if (strlen(prefix) > skip)
					skip = strlen(prefix);
			}
			prefix = strtok(NULL, " ");
		}
	}

	Q_free(prefixes);
	Q_free(name);

	return cl.players[player].name + skip;
}
开发者ID:se-sss,项目名称:ezquake-source,代码行数:51,代码来源:vx_tracker.c


示例18: DeleteReTrigger

static void DeleteReTrigger (pcre_trigger_t *t)
{
	if (t->regexp)
		(pcre_free)(t->regexp);

	if (t->regexp_extra)
		(pcre_free)(t->regexp_extra);

	if (t->regexpstr)
		Q_free(t->regexpstr);

	Q_free(t->name);
	Q_free(t);
}
开发者ID:DavidWiberg,项目名称:ezquake-source,代码行数:14,代码来源:tp_triggers.c


示例19: SList_Reset

void SList_Reset (int i) {
	if (i >= MAX_SERVER_LIST || i < 0)
		Sys_Error("SList_Switch: Bad index %d", i);

	if (slist[i].server) {
		Q_free(slist[i].server);
		slist[i].server = NULL;
	}

	if (slist[i].description) {
		Q_free(slist[i].description);
		slist[i].description = NULL;
	}
}
开发者ID:DavidWiberg,项目名称:ezquake-source,代码行数:14,代码来源:cl_slist.c


示例20: string

/*
===============
Cmd_Alias_f

Creates a new command that executes a command string (possibly ; separated)
===============
*/
void Cmd_Alias_f (void)
{
	cmd_alias_t	*a;
	int			key;
	char		*name;

	if (Cmd_Argc() == 1)
	{
		Com_Printf ("alias <name> <command> : create or modify an alias\n");
		Com_Printf ("aliaslist : list all aliases\n");
		return;
	}

	name = Cmd_Argv(1);

	// see if there's already an alias by that name
	a = Cmd_FindAlias(name);

	if (a) {
		// reuse it
		Q_free (a->name);
		Q_free (a->value);
	}
	else {
		// allocate a new one
		a = Q_malloc (sizeof(cmd_alias_t));
		a->flags = 0;

		// link it in
		a->next = cmd_alias;
		cmd_alias = a;
		key = Com_HashKey(name);
		a->hash_next = cmd_alias_hash[key];
		cmd_alias_hash[key] = a;
	}

	a->name = Q_strdup(name);
	a->value = Q_strdup(Cmd_MakeArgs(2));	// copy the rest of the command line

#ifndef SERVERONLY
	if (cbuf_current == &cbuf_svc)
		a->flags |= ALIAS_STUFFED;
	else
		a->flags &= ALIAS_STUFFED;
#endif

	if (!Q_stricmp(Cmd_Argv(0), "aliasa"))
		a->flags |= ALIAS_ARCHIVE;

}
开发者ID:matatk,项目名称:agrip,代码行数:57,代码来源:cmd.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Q_irand函数代码示例发布时间:2022-05-30
下一篇:
C++ Q_fabs函数代码示例发布时间: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