On 08/27/2015 12:52 PM, Lukas Slebodnik wrote:
On (19/08/15 15:57), Michal Židek wrote:
> On 08/12/2015 01:11 PM, Lukas Slebodnik wrote:
>> ehlo,
>>
>> attached patch shoul avoid situation as in commit
7c69221077c780e62f6c536e78675f2dc1c131bc
>> The comments does not guarantee anything.
>>
>> Author: Michal Zidek <mzidek(a)redhat.com>
>> Date: Tue Mar 10 17:30:48 2015 +0100
>>
>> DEBUG: Add missing strings for error messages
>>
>> We had more error codes than corresponding
>> messages. Also order of two messages was wrong.
>>
>> Unfortunatelly, the index of enum do not start from 0
>> and need to be converted using SSSD_ERR_IDX. I used shorter version of
>> macro "idx". Feel free to propose nicer name.
>
> I would use the SSSD_ERR_IDX and not create an alias for it.
> I think it is always better to have properly namespaced macros
> even if the are a little longer.
>
a) the macro is not in public header.
It is int util_errors.h
git grep '#include .*util_errors.h'
src/providers/dp_refresh.c:#include "util/util_errors.h"
src/providers/ipa/ipa_dyndns.h:#include "util/util_errors.h"
src/providers/krb5/krb5_child.c:#include "src/util/util_errors.h"
src/tests/sbus_codegen_tests.c:#include "util/util_errors.h"
src/tests/sbus_tests.c:#include "util/util_errors.h"
src/util/util.h:#include "util/util_errors.h"
^^^^^^^^
So it is almost everywhere with the exception of the
client code.
b) SSSD_ERR_IDX significantly decrease readability
Not properly namespacing macros can bite us in the
long term. I do not think that SSSD_ERR_IDX decreases
readability, but even if it was the case I would say
it is simply necessary. Both SSSD_ and ERR_ prefixes are
important here.
Michal
LS