Hello Jim,
I see a style difference in the change below compare to the lines just
above it.
How to test a value after an assignment.
In the while statement the value is tested implicitly.
In the if statement the value is explicitly compared against NULL.
Usually the second way is chosen to avoid the appearance of an obvious
mistake ("=" versus "==").
Especially when code is this close together, I would think that we would
want to use a consistent convention.
Or maybe you just don't want to change the style of existing code at the
same time as adding new code, correct?
Thanks,
Mike
On 3/5/2014 7:00 AM, j...@apache.org wrote:
Author: jim
Date: Wed Mar 5 15:00:56 2014
New Revision: 1574518
URL: http://svn.apache.org/r1574518
Log:
ensure cookies have name/value
Modified:
httpd/httpd/trunk/modules/loggers/mod_log_config.c
Modified: httpd/httpd/trunk/modules/loggers/mod_log_config.c
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_log_config.c?rev=1574518&r1=1574517&r2=1574518&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_log_config.c (original)
+++ httpd/httpd/trunk/modules/loggers/mod_log_config.c Wed Mar 5 15:00:56 2014
@@ -542,8 +542,9 @@ static const char *log_cookie(request_re
char *cookies = apr_pstrdup(r->pool, cookies_entry);
while ((cookie = apr_strtok(cookies, ";", &last1))) {
- char *name = apr_strtok(cookie, "=", &last2);
- if (name) {
+ char *name;
+ if (strchr(cookie, '=') &&
+ (name = apr_strtok(cookie, "=", &last2)) != NULL) {
char *value = name + strlen(name) + 1;
apr_collapse_spaces(name, name);