From: Adam C. Emerson Date: Thu, 11 Aug 2022 21:52:17 +0000 (-0400) Subject: rgw: Get rid of some COOKIE_LEN preprocessor macros X-Git-Tag: v18.1.0~499^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=77deaa9b0278e5f582385746c4e6bbc0417af4e0;p=ceph.git rgw: Get rid of some COOKIE_LEN preprocessor macros Sticking random #defines everywhere is just atrocious style. Signed-off-by: Adam C. Emerson --- diff --git a/src/rgw/driver/rados/rgw_cr_rados.h b/src/rgw/driver/rados/rgw_cr_rados.h index 03c5303ebf79e..5a0f1db20a13d 100644 --- a/src/rgw/driver/rados/rgw_cr_rados.h +++ b/src/rgw/driver/rados/rgw_cr_rados.h @@ -772,7 +772,7 @@ public: int request_complete() override; static std::string gen_random_cookie(CephContext* cct) { -#define COOKIE_LEN 16 + static constexpr std::size_t COOKIE_LEN = 16; char buf[COOKIE_LEN + 1]; gen_rand_alphanumeric(cct, buf, sizeof(buf) - 1); return buf; diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index cc65a577632e9..d0ff70b3132dd 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -1659,7 +1659,7 @@ public: ~RGWPutLC() override {} void init(rgw::sal::Driver* driver, req_state *s, RGWHandler *dialect_handler) override { -#define COOKIE_LEN 16 + static constexpr std::size_t COOKIE_LEN = 16; char buf[COOKIE_LEN + 1]; RGWOp::init(driver, s, dialect_handler);