On (14/03/14 11:06), Jakub Hrozek wrote:
On Fri, Mar 14, 2014 at 10:51:31AM +0100, Lukas Slebodnik wrote:
> >I think it is now prefered to use if (homedir_ctx == NULL) to highlight
> >homedir_ctx is a pointer,
> I cannot find anything about prefered way
>
http://www.freeipa.org/page/Coding_Style
> >but I defintly think that the space after ! is redundant.
> >
> It *IS NOT*
> '!' is very similar to 'l'
> You can compare following three lines.
> if (link) {
> if (!ink) {
> if (! ink) {
But also, pointer is not a bool, so if(!pointer) should not be used,
if(pointer == NULL) is much more readable. See also:
Please update
http://www.freeipa.org/page/Coding_Style
or start discussion on freeipa about updating coding style
if (c == false)
//it’s not clear enough: you should write
if ((c == false) == true)
//or, maybe
if (((c == false) == true) == true)
>
>0adf806066ec34b8c42ddf4d0cbd2d23f05caa50..1766e33708cd29da18c3ac4d0b94ccc33583a851
100644
> >> --- a/src/providers/ipa/ipa_subdomains_id.c
> >> +++ b/src/providers/ipa/ipa_subdomains_id.c
> >> @@ -357,10 +357,10 @@ get_subdomain_homedir_of_user(TALLOC_CTX
> >*mem_ctx, struct sss_domain_info *dom,
> >> const char **_homedir)
> >> {
> >> errno_t ret;
> >> - char *name;
> >> - char *lc_name;
> >> + const char *name;
> >> const char *homedir;
> >> TALLOC_CTX *tmp_ctx;
> >> + struct sss_nss_homedir_ctx *homedir_ctx;
> >>
> >> tmp_ctx = talloc_new(mem_ctx);
> >> if (tmp_ctx == NULL) {
> >> @@ -368,22 +368,31 @@ get_subdomain_homedir_of_user(TALLOC_CTX
> >*mem_ctx, struct sss_domain_info *dom,
> >> goto done;
> >> }
> >>
> >> - ret = sss_parse_name(tmp_ctx, dom->names, fqname, NULL, &name);
> >> + homedir_ctx = talloc_zero(tmp_ctx, struct sss_nss_homedir_ctx);
> >> + if (! homedir_ctx) {
> >> + ret = ENOMEM;
> >> + goto done;
> >> + }
> >
> >same as above
> >
Right, needs fixing, as above.
I prefer shorter version.
But it looks like there is almost agreement among other developers.
So, updated patches are attached
LS