mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
mem_malloc type triviality checks (4/8)
``` git grep -l mem_malloc | xargs perl -i -lpe 's{\((\w+) \*\*\)mem_malloc\((\S+) \* sizeof\(\1 \*\)\)}{mem_rmalloc<$1 *>($2)}' ```
This commit is contained in:
parent
4d2fdb2316
commit
1551b240d3
@ -416,7 +416,7 @@ void grFont::load(char *filename, int slot) {
|
||||
int bytesize = READ_FONT_INT(ff);
|
||||
|
||||
ft->raw_data = (uint8_t *)mem_malloc(bytesize);
|
||||
ft->char_data = (uint8_t **)mem_malloc(num_char * sizeof(uint8_t *));
|
||||
ft->char_data = mem_rmalloc<uint8_t *>(num_char);
|
||||
|
||||
READ_FONT_DATA(ff, ft->raw_data, bytesize, 1);
|
||||
|
||||
|
@ -2410,7 +2410,7 @@ void ComputeAABB(bool f_full) {
|
||||
|
||||
// temporary malloc
|
||||
rp->num_bbf_regions = 27 + num_structs_per_room[i] - 1;
|
||||
rp->bbf_list = (int16_t **)mem_malloc(MAX_REGIONS_PER_ROOM * sizeof(int16_t *));
|
||||
rp->bbf_list = mem_rmalloc<int16_t *>(MAX_REGIONS_PER_ROOM);
|
||||
for (x = 0; x < MAX_REGIONS_PER_ROOM; x++) {
|
||||
rp->bbf_list[x] = mem_rmalloc<int16_t>(rp->num_faces);
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ bool BNode_FindPath(int start_room, int i, int j, float rad) {
|
||||
ASSERT(bnlist);
|
||||
ASSERT(i >= 0 && i < bnlist->num_nodes && j >= 0 && j < bnlist->num_nodes);
|
||||
|
||||
node_list = (pq_item **)mem_malloc(bnlist->num_nodes * sizeof(pq_item *));
|
||||
node_list = mem_rmalloc<pq_item *>(bnlist->num_nodes);
|
||||
memset(node_list, 0, bnlist->num_nodes * sizeof(pq_item *));
|
||||
|
||||
PQPath.push(start_node);
|
||||
|
@ -342,7 +342,7 @@ static void bm_DeleteHashTable();
|
||||
static int bm_TestName(const char *src);
|
||||
|
||||
void bm_InitHashTable() {
|
||||
bm_hashTable = (bm_Node **)mem_malloc(bm_hashTableSize * sizeof(bm_Node *));
|
||||
bm_hashTable = mem_rmalloc<bm_Node *>(bm_hashTableSize);
|
||||
for (int a = 0; a < bm_hashTableSize; a++) {
|
||||
bm_hashTable[a] = NULL;
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ bool CFilePageAddDlg::Quit(void) {
|
||||
m_SelectedFiles = NULL;
|
||||
} else {
|
||||
|
||||
m_SelectedFiles = (char **)mem_malloc(m_NumberOfSelectedFiles * sizeof(char *));
|
||||
m_SelectedFiles = mem_rmalloc<char *>(m_NumberOfSelectedFiles);
|
||||
if (!m_SelectedFiles) {
|
||||
m_SelectedFiles = NULL;
|
||||
m_NumberOfSelectedFiles = 0;
|
||||
|
@ -362,7 +362,7 @@ int grfont_Load(const char *fname) {
|
||||
int bytesize = READ_FONT_INT(ff);
|
||||
|
||||
fnt.raw_data = (uint8_t *)mem_malloc(bytesize);
|
||||
fnt.char_data = (uint8_t **)mem_malloc(num_char * sizeof(uint8_t *));
|
||||
fnt.char_data = mem_rmalloc<uint8_t *>(num_char);
|
||||
|
||||
READ_FONT_DATA(ff, fnt.raw_data, bytesize, 1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user