[PATCH] trival: make read only const strings static
Colin King
colin.king at canonical.com
Mon Dec 11 19:59:53 UTC 2017
From: Colin Ian King <colin.king at canonical.com>
This saves populating the strings on the stack at run time.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_firmware.c | 2 +-
src/sbbr/rsdp/rsdp.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c
index 611ce8f8..bdb65258 100644
--- a/src/lib/src/fwts_firmware.c
+++ b/src/lib/src/fwts_firmware.c
@@ -89,7 +89,7 @@ int fwts_firmware_features(void)
const char *fwts_firmware_feature_string(const fwts_firmware_feature features)
{
const int n = FWTS_ARRAY_LEN(feature_names);
- const char sep[] = ", ";
+ static const char sep[] = ", ";
static char str[60];
size_t len;
char *p;
diff --git a/src/sbbr/rsdp/rsdp.c b/src/sbbr/rsdp/rsdp.c
index 57b95b17..c0589416 100644
--- a/src/sbbr/rsdp/rsdp.c
+++ b/src/sbbr/rsdp/rsdp.c
@@ -69,7 +69,7 @@ static int rsdp_sbbr_test1(fwts_framework *fw)
* 0 to 19, including the checksum field. These bytes must sum to
* zero.
*/
- const char RSDP_SIGNATURE[] = {'R', 'S', 'D', ' ', 'P', 'T', 'R', ' '};
+ static const char RSDP_SIGNATURE[] = {'R', 'S', 'D', ' ', 'P', 'T', 'R', ' '};
bool signature_pass = false;
bool checksum_pass = false;
bool rsdp_revision_pass = false;
--
2.14.1
More information about the fwts-devel
mailing list