From 88a232903fd4bd1d4f3d6602071b8b464dc4155b Mon Sep 17 00:00:00 2001
From: Serge Petrenko <sergepetrenko@tarantool.org>
Date: Thu, 20 Jun 2019 11:12:16 +0300
Subject: [PATCH] decimal: add const qualifiers for decimal_pack() and
 decimal_len()

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 8f7ca3fbef..1f9b5838d3 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 0c7b16098d..1d0f2582ec 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
-- 
GitLab