(This is a low priority issue, but ports would probably require updates, so it's good to fix this before a bad implementation propagates)
As also indicated by the comment, this function is not ideal:
|
/* TODO: Doing this via a static array is not the way to do it. */ |
|
char * strerror( int errnum ) |
|
{ |
|
if ( errnum >= _PDCLIB_ERRNO_MAX || errnum < 0 ) |
|
{ |
|
return _PDCLIB_EUNKNOWN_TEXT; |
|
} |
|
else |
|
{ |
|
return _PDCLIB_lc_messages.errno_texts[errnum]; |
|
} |
|
} |
We actually discussed this briefly downstream in this conversation:
- We have fairly large gaps in our error numbers / strings (so an array is not ideal).
- There is some ambiguity wether the error message is "unknown error" from the host OS, or if it is "unknown error" from the pdclib error_readout tool.
- There is no way to implement custom "unknown error"-messages algorithmically (for including the error number for example).
(This is a low priority issue, but ports would probably require updates, so it's good to fix this before a bad implementation propagates)
As also indicated by the comment, this function is not ideal:
pdclib/functions/string/strerror.c
Lines 13 to 24 in 862f106
We actually discussed this briefly downstream in this conversation: