showlmp_t *oldshowlmps = cl.showlmps;
cl.max_showlmps += 16;
cl.showlmps = (showlmp_t *) Mem_Alloc(cls.levelmempool, cl.max_showlmps * sizeof(showlmp_t));
- if (cl.num_showlmps)
- memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t));
if (oldshowlmps)
+ {
+ if (cl.num_showlmps)
+ memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t));
Mem_Free(oldshowlmps);
+ }
}
for (k = 0;k < cl.max_showlmps;k++)
if (cl.showlmps[k].isactive && !strcmp(cl.showlmps[k].label, lmplabel))
unsigned short hash = CRC_Block_CaseInsensitive ((const unsigned char *)shader->name, strlen (shader->name));
q3shader_hash_entry_t* entry = q3shader_data->hash + (hash % Q3SHADER_HASH_SIZE);
q3shader_hash_entry_t* lastEntry = NULL;
- while (entry != NULL)
+ do
{
if (strcasecmp (entry->shader.name, shader->name) == 0)
{
lastEntry = entry;
entry = entry->chain;
}
+ while (entry != NULL);
if (entry == NULL)
{
if (lastEntry->shader.name[0] != 0)
{
Con_DPrintf("PRVM_SetTempString: enlarging tempstrings buffer (%iKB -> %iKB)\n", old.maxsize/1024, prog->tempstringsbuf.maxsize/1024);
prog->tempstringsbuf.data = (unsigned char *) Mem_Alloc(prog->progs_mempool, prog->tempstringsbuf.maxsize);
- if (old.cursize)
- memcpy(prog->tempstringsbuf.data, old.data, old.cursize);
if (old.data)
+ {
+ if (old.cursize)
+ memcpy(prog->tempstringsbuf.data, old.data, old.cursize);
Mem_Free(old.data);
+ }
}
}
t = (char *)prog->tempstringsbuf.data + prog->tempstringsbuf.cursize;