summaryrefslogtreecommitdiffstats
path: root/89.patch
blob: 308b35fbbae6ccfc3acfc177df3073d1600a5d15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
From a95c132cad71fa6ab52fa5b4062b8dba7a17458b Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 28 Jun 2018 14:43:21 +0200
Subject: [PATCH 1/3] fix for PHP 7.3

---
 yac.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/yac.c b/yac.c
index 807d349..c234daf 100644
--- a/yac.c
+++ b/yac.c
@@ -147,7 +147,9 @@ static int yac_add_impl(zend_string *prefix, zend_string *key, zval *value, int
 			ret = yac_storage_update(ZSTR_VAL(key), ZSTR_LEN(key), (char *)&Z_DVAL_P(value), sizeof(double), flag, ttl, add, tv);
 			break;
 		case IS_STRING:
+#if PHP_VERSION_ID < 70300
 		case IS_CONSTANT:
+#endif
 			{
 				if (Z_STRLEN_P(value) > YAC_G(compress_threshold) || Z_STRLEN_P(value) > YAC_STORAGE_MAX_ENTRY_LEN) {
 					int compressed_len;
@@ -347,7 +349,9 @@ static zval * yac_get_impl(zend_string *prefix, zend_string *key, uint32_t *cas,
 				efree(data);
 				break;
 			case IS_STRING:
+#if PHP_VERSION_ID < 70300
 			case IS_CONSTANT:
+#endif
 				{
 					if ((flag & YAC_ENTRY_COMPRESSED)) {
 						size_t orig_len = ((uint32_t)flag >> YAC_ENTRY_ORIG_LEN_SHIT);

From 6d067e07b31b6b805210c29894c73c21207dd70d Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 28 Jun 2018 14:54:52 +0200
Subject: [PATCH 2/3] fix [-Wformat] warnings

---
 yac.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/yac.c b/yac.c
index c234daf..141833c 100644
--- a/yac.c
+++ b/yac.c
@@ -157,7 +157,7 @@ static int yac_add_impl(zend_string *prefix, zend_string *key, zval *value, int
 				   
 					/* if longer than this, then we can not stored the length in flag */
 					if (Z_STRLEN_P(value) > YAC_ENTRY_MAX_ORIG_LEN) {
-						php_error_docref(NULL, E_WARNING, "Value is too long(%d bytes) to be stored", Z_STRLEN_P(value));
+						php_error_docref(NULL, E_WARNING, "Value is too long(%ld bytes) to be stored", Z_STRLEN_P(value));
 						if (prefix->len) {
 							zend_string_release(prefix_key);
 						}
@@ -176,7 +176,7 @@ static int yac_add_impl(zend_string *prefix, zend_string *key, zval *value, int
 					}
 
 					if (compressed_len > YAC_STORAGE_MAX_ENTRY_LEN) {
-						php_error_docref(NULL, E_WARNING, "Value is too long(%d bytes) to be stored", Z_STRLEN_P(value));
+						php_error_docref(NULL, E_WARNING, "Value is too long(%ld bytes) to be stored", Z_STRLEN_P(value));
 						efree(compressed);
 						if (prefix->len) {
 							zend_string_release(prefix_key);
@@ -1015,13 +1015,13 @@ PHP_MINFO_FUNCTION(yac)
 		php_info_print_table_row(2, "Total Shared Memory Usage for keys(keys_memory_size)", buf);
 		snprintf(buf, sizeof(buf), "%ld", inf->v_msize);
 		php_info_print_table_row(2, "Total Shared Memory Usage for values(values_memory_size)", buf);
-		snprintf(buf, sizeof(buf), "%ld", inf->segment_size);
+		snprintf(buf, sizeof(buf), "%d", inf->segment_size);
 		php_info_print_table_row(2, "Size of Shared Memory Segment(segment_size)", buf);
-		snprintf(buf, sizeof(buf), "%ld", inf->segments_num);
+		snprintf(buf, sizeof(buf), "%d", inf->segments_num);
 		php_info_print_table_row(2, "Number of Segments (segment_num)", buf);
-		snprintf(buf, sizeof(buf), "%ld", inf->slots_size);
+		snprintf(buf, sizeof(buf), "%d", inf->slots_size);
 		php_info_print_table_row(2, "Total Slots Number(slots_size)", buf);
-		snprintf(buf, sizeof(buf), "%ld", inf->slots_num);
+		snprintf(buf, sizeof(buf), "%d", inf->slots_num);
 		php_info_print_table_row(2, "Total Used Slots(slots_num)", buf);
 		php_info_print_table_end();
 

From 7fe254cb17a9b2f17bebd3b032f1d12870c2e4ab Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 28 Jun 2018 14:57:57 +0200
Subject: [PATCH 3/3] fix warnings to make gcc happy [-Wmaybe-uninitialized]
 and [-Wunused-variable]

---
 storage/allocator/yac_allocator.c | 3 ---
 yac.c                             | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/storage/allocator/yac_allocator.c b/storage/allocator/yac_allocator.c
index 610616f..6f2024c 100644
--- a/storage/allocator/yac_allocator.c
+++ b/storage/allocator/yac_allocator.c
@@ -24,9 +24,6 @@
 #include "storage/yac_storage.h"
 #include "yac_allocator.h"
 
-static const yac_shared_memory_handlers *shared_memory_handler = NULL;
-static const char *shared_model;
-
 int yac_allocator_startup(unsigned long k_size, unsigned long size, char **msg) /* {{{ */ {
 	char *p;
 	yac_shared_segment *segments = NULL;
diff --git a/yac.c b/yac.c
index 141833c..56bbc4e 100644
--- a/yac.c
+++ b/yac.c
@@ -120,7 +120,7 @@ static int yac_add_impl(zend_string *prefix, zend_string *key, zval *value, int
 	int ret = 0, flag = Z_TYPE_P(value);
 	char *msg;
 	time_t tv;
-	zend_string *prefix_key;
+	zend_string *prefix_key = NULL;
 
 	if ((ZSTR_LEN(key) + prefix->len) > YAC_STORAGE_MAX_KEY_LEN) {
 		php_error_docref(NULL, E_WARNING, "Key%s can not be longer than %d bytes",
@@ -302,7 +302,7 @@ static zval * yac_get_impl(zend_string *prefix, zend_string *key, uint32_t *cas,
 	uint32_t flag, size = 0;
 	char *data, *msg;
 	time_t tv;
-	zend_string *prefix_key;
+	zend_string *prefix_key = NULL;
 
 	if ((ZSTR_LEN(key) + prefix->len) > YAC_STORAGE_MAX_KEY_LEN) {
 		php_error_docref(NULL, E_WARNING, "Key%s can not be longer than %d bytes",