On 25.08.19 01:37, Uwe Kleine-König wrote:

Hi,

+static noinline_for_stack > +char *errstr(char *buf, char *end, unsigned long long num,> +
struct printf_spec spec)> +{
#1: why not putting that into some separate strerror() lib function ?
    This is something I've been looking for quite some time (actually
    already hacked it up somewhere, sometime, but forgotten ...)

#2: why not just having a big case statement and leave the actual lookup
    logic to the compiler ? IMHO, could be written in a very compact way
    by some macro magic

+       for (i = 0; i < ARRAY_SIZE(errorcodes); ++i) { > +                if 
(num == errorcodes[i].err || num == -errorcodes[i].err) {

why not taking the abs value only once, instead of duplicate comp on
each iteration ?


--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
i...@metux.net -- +49-151-27565287

Reply via email to