From 9f7ef06f65b8c8e148c18487010ce26cc8c7b383 Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 1 Jun 2015 08:02:49 -0400 Subject: [PATCH] Fix two issues with C string memory consumption. These were pointed out by @msteigemann. Including cstring to obtain strlen is not necessary with some GCC releases, but may be needed on other platforms. I rewrote the call to strlen so that it does not rely on the fact that sizeof(char) == 1 on most platforms. --- include/deal.II/base/memory_consumption.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index 166d03f32b..c34e8f69a4 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -24,6 +24,7 @@ #include #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -458,7 +459,7 @@ namespace MemoryConsumption } else { - return /*Don't forget about the NUL! :]*/ sizeof(char) + strlen(string); + return sizeof(char)*(strlen(string) /*Remember the NUL*/ + 1); } } -- 2.39.5