[PATCH] Core: added const qualifier to ngx_parse_http_time argument
Zexuan Luo
spacewanderlzx at gmail.com
Fri Jan 5 09:56:40 UTC 2018
# HG changeset patch
# User spacewander <spacewanderlzx at gmail.com>
# Date 1515142886 -28800
# Fri Jan 05 17:01:26 2018 +0800
# Node ID 17d6674fe60421961903d913831d7d19b351bd11
# Parent 6d2e92acb013224e6ef2c71c9e61ab07f0b03271
Core: added const qualifier to ngx_parse_http_time argument
'ngx_parse_http_time(u_char *value, size_t len)' doesn't change the 'value'
actually, so it is safe to add const qualifier to it. With this change we could
pass const string without hacky '(u_char *)' casting.
diff -r 6d2e92acb013 -r 17d6674fe604 src/core/ngx_parse_time.c
--- a/src/core/ngx_parse_time.c Thu Dec 28 12:01:05 2017 +0200
+++ b/src/core/ngx_parse_time.c Fri Jan 05 17:01:26 2018 +0800
@@ -12,7 +12,7 @@
static ngx_uint_t mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
time_t
-ngx_parse_http_time(u_char *value, size_t len)
+ngx_parse_http_time(const u_char *value, size_t len)
{
u_char *p, *end;
ngx_int_t month;
diff -r 6d2e92acb013 -r 17d6674fe604 src/core/ngx_parse_time.h
--- a/src/core/ngx_parse_time.h Thu Dec 28 12:01:05 2017 +0200
+++ b/src/core/ngx_parse_time.h Fri Jan 05 17:01:26 2018 +0800
@@ -13,7 +13,7 @@
#include <ngx_core.h>
-time_t ngx_parse_http_time(u_char *value, size_t len);
+time_t ngx_parse_http_time(const u_char *value, size_t len);
/* compatibility */
#define ngx_http_parse_time(value, len) ngx_parse_http_time(value, len)
More information about the nginx-devel
mailing list