-
Notifications
You must be signed in to change notification settings - Fork 253
Description
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:
osal/src/os/shared/src/osapi-sockets.c
Line 239 in 1a82657
| 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.