diff mbox series

[03/13] lib: fwts_deviceytree: make a function argument const and a style change

Message ID 20180814112435.22166-4-colin.king@canonical.com
State Accepted
Headers show
Series lib: minor code clean up | expand

Commit Message

Colin Ian King Aug. 14, 2018, 11:24 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Make argument 'len' in function check_property_printable const. Also
make one minor white space code style change.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_devicetree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alex Hung Aug. 14, 2018, 7:14 p.m. UTC | #1
On 2018-08-14 04:24 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Make argument 'len' in function check_property_printable const. Also
> make one minor white space code style change.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_devicetree.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_devicetree.c b/src/lib/src/fwts_devicetree.c
> index 4ab39d02..0669561c 100644
> --- a/src/lib/src/fwts_devicetree.c
> +++ b/src/lib/src/fwts_devicetree.c
> @@ -99,7 +99,7 @@ bool check_status_property_okay(fwts_framework *fw,
>   int check_property_printable(fwts_framework *fw,
>   	const char *name,
>   	const char *buf,
> -	size_t len)
> +	const size_t len)
>   {
>   	bool printable = true;
>   	unsigned int i;
> @@ -128,7 +128,7 @@ int check_property_printable(fwts_framework *fw,
>   	}
>   
>   	/* check for a trailing nul */
> -	if (buf[len-1] != '\0') {
> +	if (buf[len - 1] != '\0') {
>   		fwts_failed(fw, LOG_LEVEL_LOW,
>   			"DTPrintablePropertyNoNul",
>   			"property \"%s\" isn't nul-terminated", name);
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Aug. 16, 2018, 9:02 a.m. UTC | #2
On 08/14/2018 07:24 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Make argument 'len' in function check_property_printable const. Also
> make one minor white space code style change.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_devicetree.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_devicetree.c b/src/lib/src/fwts_devicetree.c
> index 4ab39d02..0669561c 100644
> --- a/src/lib/src/fwts_devicetree.c
> +++ b/src/lib/src/fwts_devicetree.c
> @@ -99,7 +99,7 @@ bool check_status_property_okay(fwts_framework *fw,
>  int check_property_printable(fwts_framework *fw,
>  	const char *name,
>  	const char *buf,
> -	size_t len)
> +	const size_t len)
>  {
>  	bool printable = true;
>  	unsigned int i;
> @@ -128,7 +128,7 @@ int check_property_printable(fwts_framework *fw,
>  	}
>  
>  	/* check for a trailing nul */
> -	if (buf[len-1] != '\0') {
> +	if (buf[len - 1] != '\0') {
>  		fwts_failed(fw, LOG_LEVEL_LOW,
>  			"DTPrintablePropertyNoNul",
>  			"property \"%s\" isn't nul-terminated", name);

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_devicetree.c b/src/lib/src/fwts_devicetree.c
index 4ab39d02..0669561c 100644
--- a/src/lib/src/fwts_devicetree.c
+++ b/src/lib/src/fwts_devicetree.c
@@ -99,7 +99,7 @@  bool check_status_property_okay(fwts_framework *fw,
 int check_property_printable(fwts_framework *fw,
 	const char *name,
 	const char *buf,
-	size_t len)
+	const size_t len)
 {
 	bool printable = true;
 	unsigned int i;
@@ -128,7 +128,7 @@  int check_property_printable(fwts_framework *fw,
 	}
 
 	/* check for a trailing nul */
-	if (buf[len-1] != '\0') {
+	if (buf[len - 1] != '\0') {
 		fwts_failed(fw, LOG_LEVEL_LOW,
 			"DTPrintablePropertyNoNul",
 			"property \"%s\" isn't nul-terminated", name);