Skip to content

Scrub OSAL for direct array references #648

@jphickey

Description

@jphickey

Is your feature request related to a problem? Please describe.
In OSAL there are quite a few places with direct array references to an index, such as:

if (OS_stream_table[local_id].socket_type != OS_SocketType_STREAM)

In many functions this is repeated many times over (i.e. makes several accesses into the table entry for the given item).

Describe the solution you'd like
This should be separated to use local pointer(s) to the entry/entries in use.

First do a lookup, e.g.:

stream = OSAL_TABLE_ENTRY(OS_stream_table, local_id);

Then use stream-> to refer to that entry from there on, e.g.:

if (stream->socket_type != OS_SocketType_STREAM)

Additional context
This makes the code a lot more readable and more maintainable. The CFE was already scrubbed for this, so it makes sense for OSAL to also do the same.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions