From 6f94abef67297eabb660e0b3db2f444f654939cf Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Mon, 25 Sep 2017 22:56:58 +0200 Subject: [PATCH] nginx-1.13.4: use preprocessor define instead of const for comparison (#1483) Address a mistake I made in https://github.com/pagespeed/ngx_pagespeed/pull/1458 While testing the draft for 1.12.34.3 I noticed that older nginx versions would fail to compile. Switch kNginx13_1_4 to a #define so we can use it to properly compare. --- src/ngx_pagespeed.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ngx_pagespeed.cc b/src/ngx_pagespeed.cc index 5869a0742..579832f0c 100644 --- a/src/ngx_pagespeed.cc +++ b/src/ngx_pagespeed.cc @@ -84,13 +84,13 @@ extern ngx_module_t ngx_pagespeed; // Needed for SystemRewriteDriverFactory to use shared memory. #define PAGESPEED_SUPPORT_POSIX_SHARED_MEM +#define NGINX_1_13_4 1013004 net_instaweb::NgxRewriteDriverFactory* active_driver_factory = NULL; namespace net_instaweb { const char* kInternalEtagName = "@psol-etag"; -const int kNginx1_13_4 = 1013004; // The process context takes care of proactively initialising // a few libraries for us, some of which are not thread-safe // when they are initialized lazily. @@ -3022,7 +3022,7 @@ ngx_int_t ps_preaccess_handler(ngx_http_request_t* r) { // move handlers before try_files && content phase // As of nginx 1.13.4 we will be right before the try_files module - #if (nginx_version < kNginx1_13_4) + #if (nginx_version < NGINX_1_13_4) while (ph[i + 1].checker != ngx_http_core_try_files_phase && ph[i + 1].checker != ngx_http_core_content_phase) { ph[i] = ph[i + 1]; @@ -3089,7 +3089,7 @@ ngx_int_t ps_init(ngx_conf_t* cf) { // As of nginx 1.13.4, try_files has changed. // https://github.com/nginx/nginx/commit/129b06dc5dfab7b4513a4f274b3778cd9b8a6a22 -#if (nginx_version >= kNginx1_13_4) +#if (nginx_version >= NGINX_1_13_4) phase = NGX_HTTP_PRECONTENT_PHASE; #endif