chenBright commented on code in PR #3616:
URL: https://github.com/apache/brpc/pull/3616#discussion_r4302138134


##########
src/bvar/detail/percentile.h:
##########
@@ -129,7 +130,13 @@ class PercentileInterval {
             const size_t num_remain_from_rhs = SAMPLE_SIZE - num_remain;
             CHECK_LE(num_remain_from_rhs, rhs._num_samples);
             // Have to copy data from rhs to shuffle since it's const
-            DEFINE_SMALL_ARRAY(uint32_t, tmp, rhs._num_samples, 64);
+            uint32_t tmp_stack[64];
+            std::unique_ptr<uint32_t[]> tmp_heap;
+            uint32_t* tmp = tmp_stack;
+            if (rhs._num_samples > ARRAY_SIZE(tmp_stack)) {
+                tmp_heap.reset(new uint32_t[rhs._num_samples]);
+                tmp = tmp_heap.get();
+            }

Review Comment:
   The cause of the build failure is OpenSSL, not this compilation warning.
   
   ```text
   ../../src/brpc/details/ssl_helper.cpp:290:16: error: cannot initialize a 
variable of type 'X509_NAME *' (aka 'X509_name_st *') with an rvalue of type 
'const X509_NAME *' (aka 'const X509_name_st *')
     290 |     X509_NAME* xname = X509_get_subject_name(x);
         |                ^       ~~~~~~~~~~~~~~~~~~~~~~~~
   ../../src/brpc/details/ssl_helper.cpp:293:26: error: cannot initialize a 
variable of type 'X509_NAME_ENTRY *' (aka 'X509_name_entry_st *') with an 
rvalue of type 'const X509_NAME_ENTRY *' (aka 'const X509_name_entry_st *')
     293 |         X509_NAME_ENTRY* entry = X509_NAME_get_entry(xname, i);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to