本文整理汇总了C++中Q_free函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_free函数的具体用法?C++ Q_free怎么用?C++ Q_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}