ACK: [PATCH] trival: make read only const strings static

Alex Hung alex.hung at canonical.com
Tue Dec 12 05:25:27 UTC 2017


On 2017-12-12 03:59 AM, Colin King wrote:
> 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;
> 

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list