<div dir="ltr">Hi Kristian,<div><br></div><div style>I've attached the patch since the patch I sent through git send-mail was sent through an e-mail account that isn't subscribed to this list (waiting for moderator approval), and to make sure the spacing isn't munged again. This patch was generated against weston master as of this morning.</div>
<div style><br></div><div style>Sorry for the churn.</div><div style>-Ossama</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 7:05 AM, Kristian Høgsberg <span dir="ltr"><<a href="mailto:hoegsberg@gmail.com" target="_blank">hoegsberg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, May 13, 2013 at 11:41 PM, Othman, Ossama<br>
<<a href="mailto:ossama.othman@intel.com">ossama.othman@intel.com</a>> wrote:<br>
> Hi Kristian,<br>
><br>
>> I think it's good to go - however, inlining the patch messed up the<br>
>> whitespace. Ideally, send patches using git send-email, which can be<br>
>> configured to use smtp servers, and you can pass --annotate if you<br>
>> want to add a message or comment to the patch (put it after the ---<br>
>> that indicates the end of the commit message). Or as a last resort,<br>
>> attach the patch.<br>
><br>
><br>
> I forgot to attach the patch this last time around. Sorry about that. I'll<br>
> just resend the patch with git send-email, as you suggest.<br>
><br>
>><br>
>> As for the next thing, good catch. I'd do something like<br>
>><br>
>> for (p = config_dirs; p != NULL; p = next) {<br>
>> next = strchrnul(p, ':');<br>
>> if (*next == ':')<br>
>> next++;<br>
>><br>
>> ...<br>
>><br>
>> to keep the for (...) more readable.<br>
><br>
><br>
> Changing the loop termination to "p != NULL" causes an infinite loop since<br>
> strchnul() returns a pointer to the null character '\0', not the NULL<br>
<br>
</div>Yeah, sorry for the confusion, for a second while writing the email I<br>
was thinking that we could just use strchr instead and test for p !=<br>
NULL, but that doesn't work for getting the end of the last path<br>
element.<br>
<div class="im"><br>
> pointer. Also, the moving the next pointer past the colon must be done<br>
> after path construction, other the colon ends up at the end of the path.<br>
> How's this instead:<br>
><br>
> for (p = config_dirs; *p != '\0'; p = next) {<br>
> next = strchrnul(p, ':');<br>
> snprintf(path, sizeof path,<br>
> "%.*s/weston/%s", (int)(next - p), p, name);<br>
> fd = open(path, O_RDONLY | O_CLOEXEC);<br>
> if (fd >= 0)<br>
> return fd;<br>
><br>
> if (*next == ':')<br>
> next++;<br>
> }<br>
><br>
> Note that I also had to cast "next - p" in the snprintf() call to int since<br>
> the format specifier "%*.s" wants an int but the pointer difference on my 64<br>
> bit Ubuntu box is a long int, at least according to the format specifier<br>
> warning I get:<br>
><br>
> foo.c: In function ‘open_config_file’:<br>
> foo.c:53:5: warning: field precision specifier ‘.*’ expects argument of type<br>
> ‘int’, but argument 4 has type ‘long int’ [-Wformat]<br>
><br>
> foo.c in this case is a simple test program I wrote. I assume the cast is<br>
> safe since "next - p" should always fall within the range of type int.<br>
><br>
> Anyway, I'll resend the patch with the above changes with git send-email.<br>
<br>
</div>Yup, that all sounds good.<br>
<br>
thanks,<br>
Kristian<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br></div>