Closed slorquet closed 1 year ago
I think with sprintf
you can't make strsignal
reentrant.
Is there really no other way to implement this? It looks particularly inefficient.
Not that I'm aware of. You can see that other cases in switch/case also have a common SIG
part of the string. The only difference is that in the array it is a bit longer.
Let me think a bit of what can be an option. Maybe having a reentrant variant can be a config option or we can return just the number string and drop Signal
prefix
@slorquet this issue in not nuts-apps related, but anyway I spent some time looking into specs and tinkering some improvements in https://github.com/apache/nuttx/pull/8867. Tests are still in progress and I would appreciate if you can provide a testing feedback from your end as well (despite changes seems to be trivial, I will not be able to test it this week).
@slorquet can we close this issue now?
we can :)
Hello, What is the exact reason for this wasteful array that could be replaced by a sprintf?
https://github.com/apache/nuttx/blob/master/libs/libc/string/lib_strsignal.c#L37
Thank you.