pc-bios/s390-ccw: size_t should be unsigned
PATCH v2 1/1 pc-bios/s390-ccw: size_t should be unsigned
"size_t" should be an unsigned type according to the C standard. Thus we should also use this convention in the s390-ccw firmware to avoid confusion. I checked the sources, and apart from one spot in libc.c, the code should all be fine with this change.
---
v2: Use long instead of ssize_t in uitoa()
pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/libc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/s390-ccw/libc.c +1 -1
@@ -63,7 +63,7 @@ uint64_t atoui(const char *str)*/ char *uitoa (uint64_t num,char *str,size_t len) { -size_t num_idx =1 ;/* account for NUL */ +long num_idx =1 ;/* account for NUL */ uint64_t tmp = num;IPL_assert (str !=NULL ,"uitoa: no space allocated to store string" );
pc-bios/s390-ccw/libc.h +1 -1
@@ -12,7 +12,7 @@#ifndef S390_CCW_LIBC_H #define S390_CCW_LIBC_H -typedef long size_t ; +typedef unsigned long size_t ;typedef int bool ;typedef unsigned char uint8_t ;typedef unsigned short uint16_t ;
Signature · 1 line
1.8.3.1
Quoted 7 lines · Thomas Huth
"
size_t" should be an unsigned type according to the C standard. Thus we should also use this convention in the s390-ccw firmware to avoid confusion. I checked the sources, and apart from one spot inlibc.c, the code should all be fine with this change.Signed-off-by Thomas Huth <[email protected]>
looks better. I checked all users of size_t and this seems complete.
Quoted 34 lines
---
v2: Use long instead ofssize_tinuitoa()pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/libc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)pc-bios/s390-ccw/libc.c +1
-1@@ -63,7 +63,7 @@ uint64_t atoui(const char *str)*/ char *uitoa (uint64_t num,char *str,size_t len) { -size_t num_idx =1 ;/* account for NUL */ +long num_idx =1 ;/* account for NUL */ uint64_t tmp = num;IPL_assert (str !=NULL ,"uitoa: no space allocated to store string" );pc-bios/s390-ccw/libc.h +1
-1@@ -12,7 +12,7 @@#ifndef S390_CCW_LIBC_H #define S390_CCW_LIBC_H -typedef long size_t ; +typedef unsigned long size_t ;typedef int bool ;typedef unsigned char uint8_t ;typedef unsigned short uint16_t ;
Quoted 7 lines · Thomas Huth
"
size_t" should be an unsigned type according to the C standard. Thus we should also use this convention in the s390-ccw firmware to avoid confusion. I checked the sources, and apart from one spot inlibc.c, the code should all be fine with this change.Signed-off-by Thomas Huth <[email protected]>
Quoted 33 lines · Thomas Huth
"
size_t" should be an unsigned type according to the C standard. Thus we should also use this convention in the s390-ccw firmware to avoid confusion. I checked the sources, and apart from one spot inlibc.c, the code should all be fine with this change.Signed-off-by Thomas Huth <[email protected]>---
v2: Use long instead ofssize_tinuitoa()pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/libc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)pc-bios/s390-ccw/libc.c +1
-1@@ -63,7 +63,7 @@ uint64_t atoui(const char *str)*/ char *uitoa (uint64_t num,char *str,size_t len) { -size_t num_idx =1 ;/* account for NUL */ +long num_idx =1 ;/* account for NUL */ uint64_t tmp = num;IPL_assert (str !=NULL ,"uitoa: no space allocated to store string" );pc-bios/s390-ccw/libc.h +0
-0
pc-bios/s390-ccw/libc.h line 18
Quoted 8 lines
pc-bios/s390-ccw/libc.h +1
-1@@ -12,7 +12,7 @@#ifndef S390_CCW_LIBC_H #define S390_CCW_LIBC_H -typedef long size_t ; +typedef unsigned long size_t ;typedef int bool ;typedef unsigned char uint8_t ;typedef unsigned short uint16_t ;
Signature · 2 lines
Respectfully, - Collin Walling
Quoted 5 lines · On Mon, 16 Apr 2018 09:45:20 +0200 Thomas Huth <[email protected]> wrote:
"
size_t" should be an unsigned type according to the C standard. Thus we should also use this convention in the s390-ccw firmware to avoid confusion. I checked the sources, and apart from one spot inlibc.c, the code should all be fine with this change.
Quoted 8 lines
Signed-off-by Thomas Huth <[email protected]>---
v2: Use long instead ofssize_tinuitoa()pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/libc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
I assume you'll queue this one yourself?
Quoted 13 lines · Cornelia Huck
Quoted 10 lines · On Mon, 16 Apr 2018 09:45:20 +0200 Thomas Huth <[email protected]> wrote:
"
size_t" should be an unsigned type according to the C standard. Thus we should also use this convention in the s390-ccw firmware to avoid confusion. I checked the sources, and apart from one spot inlibc.c, the code should all be fine with this change.Signed-off-by Thomas Huth <[email protected]>---
v2: Use long instead ofssize_tinuitoa()
Quoted 7 lines
Quoted 3 lines
pc-bios/s390-ccw/libc.c | 2 +- pc-bios/s390-ccw/libc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)Reviewed-by Cornelia Huck <[email protected]>I assume you'll queue this one yourself?
Yes, I'll queue it with the other pending s390-ccw bios patches.
Thomas