diff mbox series

[13/17] Use bool for reginfo_is_eq

Message ID 20240511115400.7587-14-richard.henderson@linaro.org
State New
Headers show
Series RISU misc updates | expand

Commit Message

Richard Henderson May 11, 2024, 11:53 a.m. UTC
The function result is more naturally boolean.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 risu.h                     |  4 ++--
 risu_reginfo_aarch64.c     |  4 ++--
 risu_reginfo_arm.c         |  4 ++--
 risu_reginfo_i386.c        |  4 ++--
 risu_reginfo_loongarch64.c |  4 ++--
 risu_reginfo_m68k.c        | 16 ++++++++--------
 risu_reginfo_ppc64.c       |  4 ++--
 risu_reginfo_s390x.c       |  4 ++--
 8 files changed, 22 insertions(+), 22 deletions(-)

Comments

Philippe Mathieu-Daudé May 15, 2024, 12:56 p.m. UTC | #1
On 11/5/24 13:53, Richard Henderson wrote:
> The function result is more naturally boolean.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   risu.h                     |  4 ++--
>   risu_reginfo_aarch64.c     |  4 ++--
>   risu_reginfo_arm.c         |  4 ++--
>   risu_reginfo_i386.c        |  4 ++--
>   risu_reginfo_loongarch64.c |  4 ++--
>   risu_reginfo_m68k.c        | 16 ++++++++--------
>   risu_reginfo_ppc64.c       |  4 ++--
>   risu_reginfo_s390x.c       |  4 ++--
>   8 files changed, 22 insertions(+), 22 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/risu.h b/risu.h
index aa8cc22..4203178 100644
--- a/risu.h
+++ b/risu.h
@@ -117,8 +117,8 @@  uintptr_t get_pc(struct reginfo *ri);
 /* initialize structure from a ucontext */
 void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr);
 
-/* return 1 if structs are equal, 0 otherwise. */
-int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2);
+/* return true if structs are equal, false otherwise. */
+bool reginfo_is_eq(struct reginfo *r1, struct reginfo *r2);
 
 /* print reginfo state to a stream */
 void reginfo_dump(struct reginfo *ri, FILE *f);
diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c
index 67a2999..55a9ef6 100644
--- a/risu_reginfo_aarch64.c
+++ b/risu_reginfo_aarch64.c
@@ -262,8 +262,8 @@  void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr)
     }
 }
 
-/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */
-int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2)
+/* reginfo_is_eq: compare the reginfo structs, returns true if equal */
+bool reginfo_is_eq(struct reginfo *r1, struct reginfo *r2)
 {
     return memcmp(r1, r2, reginfo_size(r1)) == 0;
 }
diff --git a/risu_reginfo_arm.c b/risu_reginfo_arm.c
index 0e179be..d11e666 100644
--- a/risu_reginfo_arm.c
+++ b/risu_reginfo_arm.c
@@ -155,8 +155,8 @@  void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr)
     reginfo_init_vfp(ri, uc);
 }
 
-/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */
-int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2)
+/* reginfo_is_eq: compare the reginfo structs, returns true if equal */
+bool reginfo_is_eq(struct reginfo *r1, struct reginfo *r2)
 {
     return memcmp(r1, r2, sizeof(*r1)) == 0;    /* ok since we memset 0 */
 }
diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c
index f4cf9a3..1c579fa 100644
--- a/risu_reginfo_i386.c
+++ b/risu_reginfo_i386.c
@@ -234,8 +234,8 @@  void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr)
 #endif
 }
 
-/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */
-int reginfo_is_eq(struct reginfo *m, struct reginfo *a)
+/* reginfo_is_eq: compare the reginfo structs, returns true if equal */
+bool reginfo_is_eq(struct reginfo *m, struct reginfo *a)
 {
     return !memcmp(m, a, sizeof(*m));
 }
diff --git a/risu_reginfo_loongarch64.c b/risu_reginfo_loongarch64.c
index 060715f..6150a40 100644
--- a/risu_reginfo_loongarch64.c
+++ b/risu_reginfo_loongarch64.c
@@ -153,8 +153,8 @@  void reginfo_init(struct reginfo *ri, ucontext_t *context, void *siaddr)
     }
 }
 
-/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */
-int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2)
+/* reginfo_is_eq: compare the reginfo structs */
+bool reginfo_is_eq(struct reginfo *r1, struct reginfo *r2)
 {
     return !memcmp(r1, r2, sizeof(*r1));
 }
diff --git a/risu_reginfo_m68k.c b/risu_reginfo_m68k.c
index a53244d..7335195 100644
--- a/risu_reginfo_m68k.c
+++ b/risu_reginfo_m68k.c
@@ -55,13 +55,13 @@  void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr)
     }
 }
 
-/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */
-int reginfo_is_eq(struct reginfo *m, struct reginfo *a)
+/* reginfo_is_eq: compare the reginfo structs, returns true if equal */
+bool reginfo_is_eq(struct reginfo *m, struct reginfo *a)
 {
     int i;
 
     if (m->gregs[R_PS] != a->gregs[R_PS]) {
-        return 0;
+        return false;
     }
 
     for (i = 0; i < 16; i++) {
@@ -69,27 +69,27 @@  int reginfo_is_eq(struct reginfo *m, struct reginfo *a)
             continue;
         }
         if (m->gregs[i] != a->gregs[i]) {
-            return 0;
+            return false;
         }
     }
 
     if (m->fpregs.f_pcr != a->fpregs.f_pcr) {
-        return 0;
+        return false;
     }
 
     if (m->fpregs.f_psr != a->fpregs.f_psr) {
-        return 0;
+        return false;
     }
 
     for (i = 0; i < 8; i++) {
         if (m->fpregs.f_fpregs[i][0] != a->fpregs.f_fpregs[i][0] ||
             m->fpregs.f_fpregs[i][1] != a->fpregs.f_fpregs[i][1] ||
             m->fpregs.f_fpregs[i][2] != a->fpregs.f_fpregs[i][2]) {
-            return 0;
+            return false;
         }
     }
 
-    return 1;
+    return true;
 }
 
 /* reginfo_dump: print state to a stream */
diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c
index 730a565..a8e5935 100644
--- a/risu_reginfo_ppc64.c
+++ b/risu_reginfo_ppc64.c
@@ -64,8 +64,8 @@  void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr)
     ri->vrregs.vrsave = uc->uc_mcontext.v_regs->vrsave;
 }
 
-/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */
-int reginfo_is_eq(struct reginfo *m, struct reginfo *a)
+/* reginfo_is_eq: compare the reginfo structs, returns true if equal */
+bool reginfo_is_eq(struct reginfo *m, struct reginfo *a)
 {
     return memcmp(m, a, sizeof(*m)) == 0;
 }
diff --git a/risu_reginfo_s390x.c b/risu_reginfo_s390x.c
index cbf168e..d18b94f 100644
--- a/risu_reginfo_s390x.c
+++ b/risu_reginfo_s390x.c
@@ -73,8 +73,8 @@  void reginfo_init(struct reginfo *ri, ucontext_t *uc, void *siaddr)
     memcpy(ri->fprs, &uc->uc_mcontext.fpregs.fprs, sizeof(ri->fprs));
 }
 
-/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */
-int reginfo_is_eq(struct reginfo *m, struct reginfo *a)
+/* reginfo_is_eq: compare the reginfo structs */
+bool reginfo_is_eq(struct reginfo *m, struct reginfo *a)
 {
     return m->pc_offset == a->pc_offset &&
            m->fpc == a->fpc &&