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:
Jan Engelhardt 2024-08-30 20:53:29 +02:00
parent 4d2fdb2316
commit 1551b240d3
6 changed files with 6 additions and 6 deletions

View File

@ -416,7 +416,7 @@ void grFont::load(char *filename, int slot) {
int bytesize = READ_FONT_INT(ff); int bytesize = READ_FONT_INT(ff);
ft->raw_data = (uint8_t *)mem_malloc(bytesize); 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); READ_FONT_DATA(ff, ft->raw_data, bytesize, 1);

View File

@ -2410,7 +2410,7 @@ void ComputeAABB(bool f_full) {
// temporary malloc // temporary malloc
rp->num_bbf_regions = 27 + num_structs_per_room[i] - 1; 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++) { for (x = 0; x < MAX_REGIONS_PER_ROOM; x++) {
rp->bbf_list[x] = mem_rmalloc<int16_t>(rp->num_faces); rp->bbf_list[x] = mem_rmalloc<int16_t>(rp->num_faces);
} }

View File

@ -226,7 +226,7 @@ bool BNode_FindPath(int start_room, int i, int j, float rad) {
ASSERT(bnlist); ASSERT(bnlist);
ASSERT(i >= 0 && i < bnlist->num_nodes && j >= 0 && j < bnlist->num_nodes); 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 *)); memset(node_list, 0, bnlist->num_nodes * sizeof(pq_item *));
PQPath.push(start_node); PQPath.push(start_node);

View File

@ -342,7 +342,7 @@ static void bm_DeleteHashTable();
static int bm_TestName(const char *src); static int bm_TestName(const char *src);
void bm_InitHashTable() { 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++) { for (int a = 0; a < bm_hashTableSize; a++) {
bm_hashTable[a] = NULL; bm_hashTable[a] = NULL;
} }

View File

@ -404,7 +404,7 @@ bool CFilePageAddDlg::Quit(void) {
m_SelectedFiles = NULL; m_SelectedFiles = NULL;
} else { } else {
m_SelectedFiles = (char **)mem_malloc(m_NumberOfSelectedFiles * sizeof(char *)); m_SelectedFiles = mem_rmalloc<char *>(m_NumberOfSelectedFiles);
if (!m_SelectedFiles) { if (!m_SelectedFiles) {
m_SelectedFiles = NULL; m_SelectedFiles = NULL;
m_NumberOfSelectedFiles = 0; m_NumberOfSelectedFiles = 0;

View File

@ -362,7 +362,7 @@ int grfont_Load(const char *fname) {
int bytesize = READ_FONT_INT(ff); int bytesize = READ_FONT_INT(ff);
fnt.raw_data = (uint8_t *)mem_malloc(bytesize); 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); READ_FONT_DATA(ff, fnt.raw_data, bytesize, 1);