mem_malloc type triviality checks (1/8)

git grep -l mem_malloc | xargs perl -i -lpe 's{\((\w+) \*\)mem_malloc\(sizeof\(\1\)\)}{mem_rmalloc<$1>()}'
This commit is contained in:
Jan Engelhardt 2024-08-30 13:18:31 +02:00
parent ce3a988ad6
commit 6fbc86efec
23 changed files with 59 additions and 59 deletions

View File

@ -450,7 +450,7 @@ bool Inventory::AddObject(int object_handle, int flags, const char *description)
if (Object_info[newnode->oid].description) {
newnode->description = mem_strdup(Object_info[newnode->oid].description);
} else {
newnode->description = (char *)mem_malloc(sizeof(char));
newnode->description = mem_rmalloc<char>();
newnode->description[0] = 0;
}
@ -650,7 +650,7 @@ bool Inventory::AddObjectItem(int otype, int oid, int oauxt, int oauxi, int flag
newnode->description = (char *)mem_malloc(strlen(Object_info[oid].description) + 1);
strcpy(newnode->description, Object_info[oid].description);
} else {
newnode->description = (char *)mem_malloc(sizeof(char));
newnode->description = mem_rmalloc<char>();
newnode->description[0] = 0;
}

View File

@ -2000,7 +2000,7 @@ void QuickStartMission() {
// this initializes a mini one level mission with no frills.
Current_mission.cur_level = 1;
Current_mission.num_levels = 1;
Current_mission.levels = (tLevelNode *)mem_malloc(sizeof(tLevelNode));
Current_mission.levels = mem_rmalloc<tLevelNode>();
memset(Current_mission.levels, 0, sizeof(tLevelNode));
Current_level = Current_mission.levels;
if (Editor_quickplay_levelname[0] != '\0')

View File

@ -624,7 +624,7 @@ void ObjCreateEffectInfo(object *objp) {
if (objp->effect_info)
mem_free(objp->effect_info);
objp->effect_info = (effect_info_s *)mem_malloc(sizeof(effect_info_s));
objp->effect_info = mem_rmalloc<effect_info_s>();
memset(objp->effect_info, 0, sizeof(effect_info_s));
ASSERT(objp->effect_info);
objp->effect_info->sound_handle = SOUND_NONE_INDEX;

View File

@ -1500,7 +1500,7 @@ bool Osiris_BindScriptsToObject(object *obj) {
LOG_ERROR.printf("OSIRIS: Unable to load module (%s) to bind to object (%s)", default_module_name, page_name);
} else {
// allocate the memory for the object's scripts
obj->osiris_script = (tOSIRISScript *)mem_malloc(sizeof(tOSIRISScript));
obj->osiris_script = mem_rmalloc<tOSIRISScript>();
if (!obj->osiris_script) {
// out of memory
LOG_ERROR << "OSIRIS: Out of memory trying to bind script";
@ -1543,12 +1543,12 @@ bool Osiris_BindScriptsToObject(object *obj) {
#ifdef OSIRISDEBUG
tRefObj *node;
if (OSIRIS_loaded_modules[dll_id].RefRoot == NULL) {
node = OSIRIS_loaded_modules[dll_id].RefRoot = (tRefObj *)mem_malloc(sizeof(tRefObj));
node = OSIRIS_loaded_modules[dll_id].RefRoot = mem_rmalloc<tRefObj>();
} else {
node = OSIRIS_loaded_modules[dll_id].RefRoot;
while (node->next)
node = node->next;
node->next = (tRefObj *)mem_malloc(sizeof(tRefObj));
node->next = mem_rmalloc<tRefObj>();
node = node->next;
}
node->objnum = OBJNUM(obj);
@ -1578,7 +1578,7 @@ bool Osiris_BindScriptsToObject(object *obj) {
if (gos_id != -1) {
if (!obj->osiris_script) {
// we need to allocate memory for a script
obj->osiris_script = (tOSIRISScript *)mem_malloc(sizeof(tOSIRISScript));
obj->osiris_script = mem_rmalloc<tOSIRISScript>();
if (!obj->osiris_script) {
// out of memory
LOG_ERROR << "OSIRIS: Out of memory trying to bind script";
@ -1607,12 +1607,12 @@ bool Osiris_BindScriptsToObject(object *obj) {
#ifdef OSIRISDEBUG
tRefObj *node;
if (OSIRIS_loaded_modules[dll_id].RefRoot == NULL) {
node = OSIRIS_loaded_modules[dll_id].RefRoot = (tRefObj *)mem_malloc(sizeof(tRefObj));
node = OSIRIS_loaded_modules[dll_id].RefRoot = mem_rmalloc<tRefObj>();
} else {
node = OSIRIS_loaded_modules[dll_id].RefRoot;
while (node->next)
node = node->next;
node->next = (tRefObj *)mem_malloc(sizeof(tRefObj));
node->next = mem_rmalloc<tRefObj>();
node = node->next;
}
node->objnum = OBJNUM(obj);
@ -1635,7 +1635,7 @@ bool Osiris_BindScriptsToObject(object *obj) {
if (!obj->osiris_script) {
// we need to allocate memory for a script
obj->osiris_script = (tOSIRISScript *)mem_malloc(sizeof(tOSIRISScript));
obj->osiris_script = mem_rmalloc<tOSIRISScript>();
if (!obj->osiris_script) {
// out of memory
LOG_ERROR << "OSIRIS: Out of memory trying to bind script";
@ -1664,12 +1664,12 @@ bool Osiris_BindScriptsToObject(object *obj) {
#ifdef OSIRISDEBUG
tRefObj *node;
if (OSIRIS_loaded_modules[dll_id].RefRoot == NULL) {
node = OSIRIS_loaded_modules[dll_id].RefRoot = (tRefObj *)mem_malloc(sizeof(tRefObj));
node = OSIRIS_loaded_modules[dll_id].RefRoot = mem_rmalloc<tRefObj>();
} else {
node = OSIRIS_loaded_modules[dll_id].RefRoot;
while (node->next)
node = node->next;
node->next = (tRefObj *)mem_malloc(sizeof(tRefObj));
node->next = mem_rmalloc<tRefObj>();
node = node->next;
}
node->objnum = OBJNUM(obj);
@ -1705,7 +1705,7 @@ bool Osiris_BindScriptsToObject(object *obj) {
if (gos_id != -1) {
if (!obj->osiris_script) {
// we need to allocate memory for a script
obj->osiris_script = (tOSIRISScript *)mem_malloc(sizeof(tOSIRISScript));
obj->osiris_script = mem_rmalloc<tOSIRISScript>();
if (!obj->osiris_script) {
// out of memory
LOG_ERROR << "OSIRIS: Out of memory trying to bind script";
@ -1734,12 +1734,12 @@ bool Osiris_BindScriptsToObject(object *obj) {
#ifdef OSIRISDEBUG
tRefObj *node;
if (OSIRIS_loaded_modules[dll_id].RefRoot == NULL) {
node = OSIRIS_loaded_modules[dll_id].RefRoot = (tRefObj *)mem_malloc(sizeof(tRefObj));
node = OSIRIS_loaded_modules[dll_id].RefRoot = mem_rmalloc<tRefObj>();
} else {
node = OSIRIS_loaded_modules[dll_id].RefRoot;
while (node->next)
node = node->next;
node->next = (tRefObj *)mem_malloc(sizeof(tRefObj));
node->next = mem_rmalloc<tRefObj>();
node = node->next;
}
node->objnum = OBJNUM(obj);
@ -2856,7 +2856,7 @@ void *Osiris_AllocateMemory(tOSIRISMEMCHUNK *mc) {
if (!Osiris_mem_root) {
// it'll be the first node
Osiris_mem_root = (tOSIRISMEMNODE *)mem_malloc(sizeof(tOSIRISMEMNODE));
Osiris_mem_root = mem_rmalloc<tOSIRISMEMNODE>();
if (!Osiris_mem_root)
return NULL;
@ -2869,7 +2869,7 @@ void *Osiris_AllocateMemory(tOSIRISMEMCHUNK *mc) {
curr = curr->next;
}
curr->next = (tOSIRISMEMNODE *)mem_malloc(sizeof(tOSIRISMEMNODE));
curr->next = mem_rmalloc<tOSIRISMEMNODE>();
if (!curr->next)
return NULL;
error_node = &curr->next;
@ -3042,7 +3042,7 @@ void Osiris_RestoreMemoryChunks(CFILE *file) {
done = true;
} else {
// handle this node
memchunk = (tOSIRISMEMNODE *)mem_malloc(sizeof(tOSIRISMEMNODE));
memchunk = mem_rmalloc<tOSIRISMEMNODE>();
if (!memchunk) {
Error("Out of memory");
}
@ -3481,9 +3481,9 @@ void Osiris_RestoreOMMS(CFILE *file) {
// we have to rebuild the nodes
while (cf_ReadByte(file)) {
if (!currhash) {
currhash = OMMS_Hash_node_root = (tOMMSHashNode *)mem_malloc(sizeof(tOMMSHashNode));
currhash = OMMS_Hash_node_root = mem_rmalloc<tOMMSHashNode>();
} else {
currhash->next = (tOMMSHashNode *)mem_malloc(sizeof(tOMMSHashNode));
currhash->next = mem_rmalloc<tOMMSHashNode>();
currhash = currhash->next;
}
@ -3511,9 +3511,9 @@ void Osiris_RestoreOMMS(CFILE *file) {
// now go through all the nodes and right their data
while (cf_ReadByte(file)) {
if (!node) {
node = currhash->root = (tOMMSNode *)mem_malloc(sizeof(tOMMSNode));
node = currhash->root = mem_rmalloc<tOMMSNode>();
} else {
node->next = (tOMMSNode *)mem_malloc(sizeof(tOMMSNode));
node->next = mem_rmalloc<tOMMSNode>();
node = node->next;
}
@ -3550,7 +3550,7 @@ tOMMSHashNode *Osiris_OMMS_FindHashNode(char *script_name, bool autocreate) {
if (!autocreate)
return NULL;
curr = OMMS_Hash_node_root = (tOMMSHashNode *)mem_malloc(sizeof(tOMMSHashNode));
curr = OMMS_Hash_node_root = mem_rmalloc<tOMMSHashNode>();
} else {
if (curr->script_name && !stricmp(curr->script_name, script_name)) {
// the root node matches
@ -3571,7 +3571,7 @@ tOMMSHashNode *Osiris_OMMS_FindHashNode(char *script_name, bool autocreate) {
if (!autocreate)
return NULL;
curr->next = (tOMMSHashNode *)mem_malloc(sizeof(tOMMSHashNode));
curr->next = mem_rmalloc<tOMMSHashNode>();
curr = curr->next;
}
@ -3619,7 +3619,7 @@ tOMMSNode *Osiris_OMMS_FindNode(tOMMSHashNode *root, uint32_t uid, bool autocrea
if (!autocreate)
return NULL;
curr = root->root = (tOMMSNode *)mem_malloc(sizeof(tOMMSNode));
curr = root->root = mem_rmalloc<tOMMSNode>();
} else {
if (curr->unique_id == uid) {
// the root node matches
@ -3640,7 +3640,7 @@ tOMMSNode *Osiris_OMMS_FindNode(tOMMSHashNode *root, uint32_t uid, bool autocrea
if (!autocreate)
return NULL;
curr->next = (tOMMSNode *)mem_malloc(sizeof(tOMMSNode));
curr->next = mem_rmalloc<tOMMSNode>();
curr = curr->next;
}

View File

@ -4060,12 +4060,12 @@ void TelCom_AddCustomKeyEvent(int key_id, int event_id) {
tCustomKeyEventID *curr = Telcom_custom_key_event_root;
if (!curr) {
curr = Telcom_custom_key_event_root = (tCustomKeyEventID *)mem_malloc(sizeof(tCustomKeyEventID));
curr = Telcom_custom_key_event_root = mem_rmalloc<tCustomKeyEventID>();
} else {
while (curr->next) {
curr = curr->next;
}
curr->next = (tCustomKeyEventID *)mem_malloc(sizeof(tCustomKeyEventID));
curr->next = mem_rmalloc<tCustomKeyEventID>();
curr = curr->next;
}

View File

@ -135,7 +135,7 @@ int BSPGetMineChecksum() {
bspnode *NewBSPNode(void) {
bspnode *node;
if ((node = (bspnode *)mem_malloc(sizeof(bspnode))) == NULL) {
if ((node = mem_rmalloc<bspnode>()) == NULL) {
return NULL;
}
@ -164,7 +164,7 @@ bsppolygon *NewPolygon(int roomnum, int facenum, int numverts) {
bsppolygon *newpoly;
vector *verts;
newpoly = (bsppolygon *)mem_malloc(sizeof(bsppolygon));
newpoly = mem_rmalloc<bsppolygon>();
if (newpoly == NULL) {
LOG_ERROR << "NewPolygon: Couldn't allocate polygon";
@ -396,7 +396,7 @@ int SplitPolygon(bspplane *plane, bsppolygon *testpoly, bsppolygon **frontpoly,
vertptr2 = polyvert[(i + 1) % numvert];
t = dists[i] / (dists[i] - dists[i + 1]);
newvert[num_new_verts] = (vector *)mem_malloc(sizeof(vector));
newvert[num_new_verts] = mem_rmalloc<vector>();
/* Now we must generate the split point. This is simply
* an equation in the form Origin + t*Direction

View File

@ -260,7 +260,7 @@ static bool Credits_LoadCredits(const char *filename) {
// Generate blank lines for the start
cur_credit->text = NULL;
cur_credit->type = CLTYPE_BLANK;
cur_credit->next = (creditline *)mem_malloc(sizeof(creditline));
cur_credit->next = mem_rmalloc<creditline>();
ASSERT(cur_credit->next);
cur_credit = cur_credit->next;
cur_credit->next = NULL;
@ -286,7 +286,7 @@ static bool Credits_LoadCredits(const char *filename) {
if (Credits_ParseLine(curline, cur_credit)) {
// Make a new line
cur_credit->next = (creditline *)mem_malloc(sizeof(creditline));
cur_credit->next = mem_rmalloc<creditline>();
ASSERT(cur_credit->next);
cur_credit = cur_credit->next;
cur_credit->next = NULL;

View File

@ -132,12 +132,12 @@ tGraphNode *DebugGraph_AddNode(void) {
tDebugGraphNode *curr = DebugGraphNode_root;
if (!curr) {
curr = DebugGraphNode_root = (tDebugGraphNode *)mem_malloc(sizeof(tDebugGraphNode));
curr = DebugGraphNode_root = mem_rmalloc<tDebugGraphNode>();
} else {
while (curr->next) {
curr = curr->next;
}
curr->next = (tDebugGraphNode *)mem_malloc(sizeof(tDebugGraphNode));
curr->next = mem_rmalloc<tDebugGraphNode>();
curr = curr->next;
}

View File

@ -884,7 +884,7 @@ void ListenDedicatedSocket(void) {
PrintDedicatedMessage(TXT_DS_NEWCONNECT, inet_ntoa(conn_addr.sin_addr));
PrintDedicatedMessage("\n");
dedicated_socket *new_socket;
new_socket = (dedicated_socket *)mem_malloc(sizeof(dedicated_socket));
new_socket = mem_rmalloc<dedicated_socket>();
if (Head_sock)
Head_sock->prev = new_socket;
new_socket->next = Head_sock;

View File

@ -1123,7 +1123,7 @@ void FramePush(int x1, int y1, int x2, int y2, bool clear) {
ASSERT(!FrameStackRoot);
// we need to allocate for the root
// curr = FrameStackRoot = FrameStackPtr = (tFrameStackFrame *)mem_malloc(sizeof(tFrameStackFrame));
// curr = FrameStackRoot = FrameStackPtr = mem_rmalloc<tFrameStackFrame>();
curr = FrameStackRoot = FrameStackPtr = &FrameStack[0];
if (!curr) {
Error("Out of memory\n");
@ -1134,7 +1134,7 @@ void FramePush(int x1, int y1, int x2, int y2, bool clear) {
} else {
// add on to the end of the list
curr->next = FrameStackPtr = &FrameStack[FrameStackDepth];
// curr->next = FrameStackPtr = (tFrameStackFrame *)mem_malloc(sizeof(tFrameStackFrame));
// curr->next = FrameStackPtr = mem_rmalloc<tFrameStackFrame>();
if (!curr->next) {
Error("Out of memory\n");
}

View File

@ -1334,7 +1334,7 @@ bool SimpleStartLevel(const std::filesystem::path& level_name) {
Current_mission.cur_level = 1;
Current_mission.num_levels = 1;
Current_mission.levels = (tLevelNode *)mem_malloc(sizeof(tLevelNode));
Current_mission.levels = mem_rmalloc<tLevelNode>();
memset(Current_mission.levels, 0, sizeof(tLevelNode));
Current_level = nullptr;

View File

@ -416,7 +416,7 @@ int AllocateProceduralForTexture(int handle) {
w = h = 128;
}
GameTextures[handle].procedural = (proc_struct *)mem_malloc(sizeof(proc_struct));
GameTextures[handle].procedural = mem_rmalloc<proc_struct>();
ASSERT(GameTextures[handle].procedural);
GameTextures[handle].procedural->proc1 = NULL;

View File

@ -24,7 +24,7 @@
listnode *NewListNode(void) {
listnode *node;
node = (listnode *)mem_malloc(sizeof(listnode));
node = mem_rmalloc<listnode>();
if (node == NULL) {
LOG_FATAL << "Not enough memory for a new listnode!";
Int3();

View File

@ -664,7 +664,7 @@ void GrowString::operator+=(char *str) {
return;
if (root.string_data) {
tbufferinfo *node;
node = (tbufferinfo *)mem_malloc(sizeof(tbufferinfo));
node = mem_rmalloc<tbufferinfo>();
if (!node)
return;
node->string_data = (char *)mem_malloc(strlen(str) + 2);

View File

@ -3338,7 +3338,7 @@ void SetObjectControlType(object *obj, int control_type) {
int count = 0;
int i;
obj->ai_info = (ai_frame *)mem_malloc(sizeof(ai_frame));
obj->ai_info = mem_rmalloc<ai_frame>();
memset(obj->ai_info, 0x00, sizeof(ai_frame)); // DAJ clear the baby
for (i = 0; i < num_wbs; i++) {

View File

@ -116,7 +116,7 @@ int AllocObjectID(int type, bool f_anim, bool f_weapons, bool f_ai) {
extern void AISetDefault(t_ai_info * ai_info_ptr);
if (f_ai) {
Object_info[i].ai_info = (t_ai_info *)mem_malloc(sizeof(t_ai_info));
Object_info[i].ai_info = mem_rmalloc<t_ai_info>();
memset(Object_info[i].ai_info, 0, sizeof(t_ai_info));
AISetDefault(Object_info[i].ai_info);
}

View File

@ -390,7 +390,7 @@ bm_Node *bm_insertNode(bm_T data) {
************************************************/
/* insert bm_Node at beginning of list */
bucket = bm_hash(data);
if ((p = (bm_Node *)mem_malloc(sizeof(bm_Node))) == 0) {
if ((p = mem_rmalloc<bm_Node>()) == 0) {
exit(1);
}
p0 = bm_hashTable[bucket];

View File

@ -712,7 +712,7 @@ int EBNode_AddNode(int roomnum, vector *pnt, bool f_from_editor, bool f_check_fo
if (new_node != 0)
nlist->nodes = (bn_node *)mem_realloc(nlist->nodes, sizeof(bn_node) * (nlist->num_nodes));
else
nlist->nodes = (bn_node *)mem_malloc(sizeof(bn_node));
nlist->nodes = mem_rmalloc<bn_node>();
nlist->nodes[new_node].edges = NULL;
nlist->nodes[new_node].num_edges = 0;
@ -897,7 +897,7 @@ void EBNode_AddEdge(int spnt, int sroom, int epnt, int eroom, bool f_add_reverse
snlist->nodes[spnt].num_edges++;
if (new_edge == 0) {
snlist->nodes[spnt].edges = (bn_edge *)mem_malloc(sizeof(bn_edge));
snlist->nodes[spnt].edges = mem_rmalloc<bn_edge>();
} else {
snlist->nodes[spnt].edges =
(bn_edge *)mem_realloc(snlist->nodes[spnt].edges, sizeof(bn_edge) * snlist->nodes[spnt].num_edges);

View File

@ -1041,7 +1041,7 @@ void DoRadiosityForRooms() {
Light_surfaces[surface_index].verts = (vector *)mem_malloc(sizeof(vector) * 3);
ASSERT(Light_surfaces[surface_index].verts != NULL);
Light_surfaces[surface_index].elements = (rad_element *)mem_malloc(sizeof(rad_element));
Light_surfaces[surface_index].elements = mem_rmalloc<rad_element>();
ASSERT(Light_surfaces[surface_index].elements != NULL);
Light_surfaces[surface_index].elements[0].verts = (vector *)mem_malloc(sizeof(vector) * 3);
@ -1911,7 +1911,7 @@ void DoRadiosityForTerrain() {
}
// Do upper left triangle
Light_surfaces[i * 2].elements = (rad_element *)mem_malloc(sizeof(rad_element));
Light_surfaces[i * 2].elements = mem_rmalloc<rad_element>();
ASSERT(Light_surfaces[i * 2].elements != NULL);
Light_surfaces[i * 2].elements[0].verts = (vector *)mem_malloc(sizeof(vector) * 3);
@ -1951,7 +1951,7 @@ void DoRadiosityForTerrain() {
// Now do lower right
Light_surfaces[i * 2 + 1].elements = (rad_element *)mem_malloc(sizeof(rad_element));
Light_surfaces[i * 2 + 1].elements = mem_rmalloc<rad_element>();
ASSERT(Light_surfaces[i * 2 + 1].elements != NULL);
Light_surfaces[i * 2 + 1].elements[0].verts = (vector *)mem_malloc(sizeof(vector) * 3);
@ -1996,7 +1996,7 @@ void DoRadiosityForTerrain() {
Light_surfaces[surf_index].verts = (vector *)mem_malloc(sizeof(vector) * 3);
ASSERT(Light_surfaces[surf_index].verts != NULL);
Light_surfaces[surf_index].elements = (rad_element *)mem_malloc(sizeof(rad_element));
Light_surfaces[surf_index].elements = mem_rmalloc<rad_element>();
ASSERT(Light_surfaces[surf_index].elements != NULL);
Light_surfaces[surf_index].elements[0].verts = (vector *)mem_malloc(sizeof(vector) * 3);

View File

@ -661,7 +661,7 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
http_lastaslu->abort = true;
async_dns_lookup *newaslu;
newaslu = (async_dns_lookup *)mem_malloc(sizeof(async_dns_lookup));
newaslu = mem_rmalloc<async_dns_lookup>();
memset(&newaslu->ip, 0, sizeof(uint32_t));
newaslu->host = hostname;
newaslu->done = false;

View File

@ -1087,7 +1087,7 @@ void SetPolymodelProperties(bsp_info *subobj, char *props) {
subobj->flags |= SOF_GLOW;
if (subobj->glow_info == nullptr) // DAJ may already exist
subobj->glow_info = (glowinfo *)mem_malloc(sizeof(glowinfo));
subobj->glow_info = mem_rmalloc<glowinfo>();
subobj->glow_info->glow_r = r;
subobj->glow_info->glow_g = g;
@ -1111,7 +1111,7 @@ void SetPolymodelProperties(bsp_info *subobj, char *props) {
subobj->flags |= SOF_THRUSTER;
if (subobj->glow_info == nullptr) // DAJ may already exist
subobj->glow_info = (glowinfo *)mem_malloc(sizeof(glowinfo));
subobj->glow_info = mem_rmalloc<glowinfo>();
subobj->glow_info->glow_r = r;
subobj->glow_info->glow_g = g;

View File

@ -663,7 +663,7 @@ int http_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
http_lastaslu->abort = true;
async_dns_lookup *newaslu;
newaslu = (async_dns_lookup *)mem_malloc(sizeof(async_dns_lookup));
newaslu = mem_rmalloc<async_dns_lookup>();
memset(&newaslu->ip, 0, sizeof(uint32_t));
newaslu->host = hostname;
newaslu->done = false;

View File

@ -1181,7 +1181,7 @@ int nw_SendReliable(uint32_t socketid, uint8_t *data, int length, bool urgent) {
// mprintf(0,"Sending in nw_SendReliable() %d bytes seq=%d.\n",length,rsocket->theirsequence);
rsocket->send_len[i] = length;
rsocket->sbuffers[i] = (reliable_net_sendbuffer *)mem_malloc(sizeof(reliable_net_sendbuffer));
rsocket->sbuffers[i] = mem_rmalloc<reliable_net_sendbuffer>();
memcpy(rsocket->sbuffers[i]->buffer, data, length);
@ -1507,7 +1507,7 @@ void nw_WorkReliable(uint8_t *data, int len, network_address *naddr) {
rsocket->recv_len[i] = max_len; // INTEL_SHORT(rcv_buff.data_len);
else
rsocket->recv_len[i] = INTEL_SHORT(rcv_buff.data_len);
rsocket->rbuffers[i] = (reliable_net_rcvbuffer *)mem_malloc(sizeof(reliable_net_rcvbuffer));
rsocket->rbuffers[i] = mem_rmalloc<reliable_net_rcvbuffer>();
memcpy(rsocket->rbuffers[i]->buffer, rcv_buff.data, rsocket->recv_len[i]);
rsocket->rsequence[i] = INTEL_SHORT(rcv_buff.seq);
// mprintf(0,"Adding packet to receive buffer in nw_ReceiveReliable().\n");
@ -2134,7 +2134,7 @@ int nw_Asyncgethostbyname(uint32_t *ip, int command, char *hostname) {
#if (!defined(POSIX))
async_dns_lookup *newaslu;
newaslu = (async_dns_lookup *)mem_malloc(sizeof(async_dns_lookup));
newaslu = mem_rmalloc<async_dns_lookup>();
memset(&newaslu->ip, 0, sizeof(uint32_t));
newaslu->host = hostname;
newaslu->done = false;