summaryrefslogtreecommitdiffstats
path: root/upstream.patch
blob: 6cac41c90b41e95856b2fff5b85ddeabfa1fe61c (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
From 08b00579fd9d2abd5d5116bbda27f8eceaba6038 Mon Sep 17 00:00:00 2001
From: dormando <dormando@rydia.net>
Date: Thu, 14 Nov 2024 10:04:12 -0800
Subject: [PATCH] proxy: fix compilation issue on beta RHEL/GCC

Apparently _rotl no-go as a function name. no idea why but we generally
use the mcp_ and _mcp namespace anyway.

Fixes #1186
---
 proxy_lua.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/proxy_lua.c b/proxy_lua.c
index 8a579d7ab..4309f0167 100644
--- a/proxy_lua.c
+++ b/proxy_lua.c
@@ -1409,13 +1409,13 @@ static int mcplib_log_req(lua_State *L) {
     return 0;
 }
 
-static inline uint32_t _rotl(const uint32_t x, int k) {
+static inline uint32_t _mcp_rotl(const uint32_t x, int k) {
     return (x << k) | (x >> (32 - k));
 }
 
 // xoroshiro128++ 32bit version.
-static uint32_t _nextrand(uint32_t *s) {
-    const uint32_t result = _rotl(s[0] + s[3], 7) + s[0];
+static uint32_t _mcp_nextrand(uint32_t *s) {
+    const uint32_t result = _mcp_rotl(s[0] + s[3], 7) + s[0];
 
     const uint32_t t = s[1] << 9;
 
@@ -1426,7 +1426,7 @@ static uint32_t _nextrand(uint32_t *s) {
 
     s[2] ^= t;
 
-    s[3] = _rotl(s[3], 11);
+    s[3] = _mcp_rotl(s[3], 11);
 
     return result;
 }
@@ -1474,7 +1474,7 @@ static int mcplib_log_reqsample(lua_State *L) {
     } else if (rate > 0) {
         // slightly biased random-to-rate without adding a loop, which is
         // completely fine for this use case.
-        uint32_t rnd = (uint64_t)_nextrand(t->proxy_rng) * (uint64_t)rate >> 32;
+        uint32_t rnd = (uint64_t)_mcp_nextrand(t->proxy_rng) * (uint64_t)rate >> 32;
         if (rnd == 0) {
             do_log = true;
         }