From: Serge Petrenko <sergepetrenko@tarantool.org> To: vdavydov.dev@gmail.com Cc: tarantool-patches@freelists.org, Serge Petrenko <sergepetrenko@tarantool.org> Subject: [PATCH 2/3] decimal: add const qualifiers for decimal_pack() and decimal_len() Date: Fri, 21 Jun 2019 12:02:06 +0300 [thread overview] Message-ID: <03501e5f3d0541bf24c9afa1129438a4e2a7e8ef.1561107237.git.sergepetrenko@tarantool.org> (raw) In-Reply-To: <cover.1561107237.git.sergepetrenko@tarantool.org> The const qualifiers weren't there initially for some reason. Fix this. Part of #692 --- src/lib/core/decimal.c | 4 ++-- src/lib/core/decimal.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/core/decimal.c b/src/lib/core/decimal.c index 8f7ca3fbe..1f9b5838d 100644 --- a/src/lib/core/decimal.c +++ b/src/lib/core/decimal.c @@ -310,14 +310,14 @@ decimal_sqrt(decimal_t *res, const decimal_t *lhs) } uint32_t -decimal_len(decimal_t *dec) +decimal_len(const decimal_t *dec) { /* 1 + ceil((digits + 1) / 2) */ return 2 + dec->digits / 2; } char * -decimal_pack(char *data, decimal_t *dec) +decimal_pack(char *data, const decimal_t *dec) { uint32_t len = decimal_len(dec); *data++ = decimal_scale(dec); diff --git a/src/lib/core/decimal.h b/src/lib/core/decimal.h index 0c7b16098..1d0f2582e 100644 --- a/src/lib/core/decimal.h +++ b/src/lib/core/decimal.h @@ -173,7 +173,7 @@ decimal_sqrt(decimal_t *res, const decimal_t *lhs); /** @return The length in bytes decimal packed representation will take. */ uint32_t -decimal_len(decimal_t *dec); +decimal_len(const decimal_t *dec); /** * Convert a decimal \a dec to its packed representation. @@ -181,7 +181,7 @@ decimal_len(decimal_t *dec); * @return data + decimal_len(dec); */ char * -decimal_pack(char *data, decimal_t *dec); +decimal_pack(char *data, const decimal_t *dec); /** * Using a packed representation of size \a len pointed to by -- 2.20.1 (Apple Git-117)
next prev parent reply other threads:[~2019-06-21 9:02 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-21 9:02 [PATCH 0/3] decimal. Add internal methods to encode/decode decimals to msgpack Serge Petrenko 2019-06-21 9:02 ` [PATCH 1/3] lib: update msgpuck library Serge Petrenko 2019-06-21 16:00 ` Vladimir Davydov 2019-06-21 9:02 ` Serge Petrenko [this message] 2019-06-21 16:00 ` [PATCH 2/3] decimal: add const qualifiers for decimal_pack() and decimal_len() Vladimir Davydov 2019-06-21 9:02 ` [PATCH 3/3] decimal: allow to encode/decode decimals as MsgPack Serge Petrenko 2019-06-24 8:35 ` Vladimir Davydov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=03501e5f3d0541bf24c9afa1129438a4e2a7e8ef.1561107237.git.sergepetrenko@tarantool.org \ --to=sergepetrenko@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=vdavydov.dev@gmail.com \ --subject='Re: [PATCH 2/3] decimal: add const qualifiers for decimal_pack() and decimal_len()' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox