From mboxrd@z Thu Jan 1 00:00:00 1970
From: Przemyslaw Marczak
Date: Fri, 10 Oct 2014 13:49:14 +0200
Subject: [U-Boot] [PATCH 01/19] lib: errno: introduce errno_str():
returns errno related message
In-Reply-To:
References: <1412801335-1591-1-git-send-email-p.marczak@samsung.com>
<1412801335-1591-2-git-send-email-p.marczak@samsung.com>
<5436B69A.3070905@samsung.com>
Message-ID: <5437C7BA.3020106@samsung.com>
List-Id:
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
To: u-boot@lists.denx.de
Hello Joakim,
On 10/10/2014 07:03 AM, Joakim Tjernlund wrote:
> Przemyslaw Marczak wrote on 2014/10/09 18:23:54:
>>
>> Hello Joakim,
>>
>> On 10/09/2014 08:46 AM, Joakim Tjernlund wrote:
>>>> From: Przemyslaw Marczak
>>>>
>>>> The functions error's numbers are standarized - but the error
>>>> messages are not.
>>>>
>>>> The errors are often handled with unclear error messages,
>>>> so why not use an errno standarized messages.
>>>>
>>>> Advantages:
>>>> - This could decrease the binary size.
>>>
>>> Having an array of string ptrs adds some extra space needs.
>>> Each str needs a ptr and that ptr needs relocation, 8 bytes on 32 bits
>>>
>>> If you want to save space do this instead
>>> static const char const errno_message[] =
>>> "Success\0Operation not permitted\0No such file or directory" etc.
>>> Then count "\0" to find the error msg.
>>>
>>> Jocke
>>>
>>
>> Is this really a problem to add some array with the pointers?
>
> Probably not, I only mentioned this because you claimed it could reduces
> size
> as if that was important to you.
>
> Jocke
>
I meant that it will reduce the size, if we could change the whole code
"common message string parts" with a pointer to some standard message.
>>
>> You are right, this array requires some additional space, but this is
>> not the main reason of introducing this function. This can be enabled
>> optional, so maybe for the less memory and slower devices this shouldn't
>
>> be used - but in the other way, we see many text messages in the code
>> that could be replaced with the one from that array.
>> So, which is better?
>>
>> This helps me sometimes, so I added this as some extra feature.
>
>
>
Your notice about the size was right, but I hope that U-Boot is used for
machines, in which this doesn't make a difference - and the code
is still simple and the "error messages" - means what they should mean.
Best Regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com