On Sun, 12 Oct 2014 18:49:54 -0500 "Peter A. Bigot" <p...@pabigot.com> wrote:
> ++ npasswd_paths = build_passwd_paths(NULL); > ++ if (npasswd_paths) { > ++ passwd_paths = malloc(npasswd_paths * > sizeof(*passwd_paths)); > ++ if (!passwd_paths) { > ++ pseudo_diag("couldn't allocate space for passwd > paths.\n"); > ++ exit(1); > ++ } > ++ build_passwd_paths(passwd_paths); I'm slightly inclined to think that this might be better done with a function which counts colons and then builds the path list accordingly. But I basically like the idea of supporting a path list. As I recall, we talked about this early on, but for some reason I formed the theory that it wasn't necessary. I'd point out that strictly speaking, the change from [] to * doesn't matter in function parameter lists, and I tend to prefer [] when the argument is logically an array rather than a pointer to a single item, except that this preference is not something I'm very consistent about. But this does seem to me to be correct. I'll have to think about it a bit because, while the "call once to find out how much storage you need, again to use the storage" idiom is pretty good, I think its primary benefit over simpler calling patterns is that it can be used with arbitrary memory allocation patterns or goals. In this case, with only one caller, we probably don't need it. That said, if I'm still busy this week (which looks likely) it's not a bad idea to merge this as-is and wait for 1.6.3 for arguable improvements, since this is pretty clearly correct. -s -- Listen, get this. Nobody with a good compiler needs to be justified. -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core