[sheepdog] [PATCH] define constant for uint64 decimal string representation

Sebastian Wiedenroth sebastian.wiedenroth at skylime.net
Wed May 16 09:52:48 CEST 2012


Signed-off-by: Sebastian Wiedenroth <wiedi at frubar.net>
---
 collie/collie.h |    2 ++
 collie/node.c   |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/collie/collie.h b/collie/collie.h
index 829a4ee..c698e36 100644
--- a/collie/collie.h
+++ b/collie/collie.h
@@ -26,6 +26,8 @@
 #define TEXT_NORMAL "\033[0m"
 #define TEXT_BOLD   "\033[1m"
 
+#define UINT64_DECIMAL_SIZE 21
+
 struct sd_option {
 	int val;
 	const char *name;
diff --git a/collie/node.c b/collie/node.c
index 6db3b3c..4fc0f72 100644
--- a/collie/node.c
+++ b/collie/node.c
@@ -54,7 +54,7 @@ static int node_info(int argc, char **argv)
 {
 	int i, ret, success = 0;
 	uint64_t total_size = 0, total_avail = 0, total_vdi_size = 0;
-	char total_str[21], avail_str[21], vdi_size_str[21];
+	char total_str[UINT64_DECIMAL_SIZE], avail_str[UINT64_DECIMAL_SIZE], vdi_size_str[UINT64_DECIMAL_SIZE];
 
 	if (!raw_output)
 		printf("Id\tSize\tUsed\tUse%%\n");
@@ -65,7 +65,7 @@ static int node_info(int argc, char **argv)
 		unsigned wlen, rlen;
 		struct sd_node_req req;
 		struct sd_node_rsp *rsp = (struct sd_node_rsp *)&req;
-		char store_str[21], free_str[21];
+		char store_str[UINT64_DECIMAL_SIZE], free_str[UINT64_DECIMAL_SIZE];
 
 		addr_to_str(name, sizeof(name), node_list_entries[i].addr, 0);
 
-- 
1.7.9.4





More information about the sheepdog mailing list