Skip to content

Commit

Permalink
Merge pull request #1972 from jphickey/fix-1971-alias-warning
Browse files Browse the repository at this point in the history
Fix #1971, avoid alias warning on some compilers
  • Loading branch information
astrogeco committed Sep 22, 2021
2 parents 09cf122 + 8dc1503 commit 87120fb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions modules/sb/fsw/src/cfe_sb_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,16 @@ void CFE_SB_TrackingListAdd(CFE_SB_BufferLink_t *List, CFE_SB_BufferLink_t *Node
*-----------------------------------------------------------------*/
CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(size_t MaxMsgSize)
{
int32 stat1;
size_t AllocSize;
CFE_SB_BufferD_t *bd = NULL;
int32 stat1;
size_t AllocSize;
CFE_ES_MemPoolBuf_t addr = NULL;
CFE_SB_BufferD_t * bd;

/* The allocation needs to include enough space for the descriptor object */
AllocSize = MaxMsgSize + CFE_SB_BUFFERD_CONTENT_OFFSET;

/* Allocate a new buffer descriptor from the SB memory pool.*/
stat1 = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t *)&bd, CFE_SB_Global.Mem.PoolHdl, AllocSize);
stat1 = CFE_ES_GetPoolBuf(&addr, CFE_SB_Global.Mem.PoolHdl, AllocSize);
if (stat1 < 0)
{
return NULL;
Expand All @@ -134,6 +135,7 @@ CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(size_t MaxMsgSize)
} /* end if */

/* Initialize the buffer descriptor structure. */
bd = (CFE_SB_BufferD_t *)addr;
memset(bd, 0, CFE_SB_BUFFERD_CONTENT_OFFSET);

bd->MsgId = CFE_SB_INVALID_MSG_ID;
Expand Down Expand Up @@ -214,11 +216,11 @@ void CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd)
*-----------------------------------------------------------------*/
CFE_SB_DestinationD_t *CFE_SB_GetDestinationBlk(void)
{
int32 Stat;
CFE_SB_DestinationD_t *Dest = NULL;
int32 Stat;
CFE_ES_MemPoolBuf_t addr = NULL;

/* Allocate a new destination descriptor from the SB memory pool.*/
Stat = CFE_ES_GetPoolBuf((CFE_ES_MemPoolBuf_t *)&Dest, CFE_SB_Global.Mem.PoolHdl, sizeof(CFE_SB_DestinationD_t));
Stat = CFE_ES_GetPoolBuf(&addr, CFE_SB_Global.Mem.PoolHdl, sizeof(CFE_SB_DestinationD_t));
if (Stat < 0)
{
return NULL;
Expand All @@ -232,7 +234,7 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestinationBlk(void)
CFE_SB_Global.StatTlmMsg.Payload.PeakMemInUse = CFE_SB_Global.StatTlmMsg.Payload.MemInUse;
} /* end if */

return Dest;
return (CFE_SB_DestinationD_t *)addr;
}

/*----------------------------------------------------------------
Expand Down

0 comments on commit 87120fb

Please sign in to comment.