poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITTED] pkl-rt: simplify code that calls pretty-printers


From: Jose E. Marchesi
Subject: [COMMITTED] pkl-rt: simplify code that calls pretty-printers
Date: Fri, 27 Jan 2023 01:51:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

No need to allocate that additional local variable.

2023-01-27  Jose E. Marchesi  <jemarch@gnu.org>

        * libpoke/pkl-rt.pk (_pkl_print_format_any): Simplify code.
---
 ChangeLog         |  4 ++++
 libpoke/pkl-rt.pk | 15 ++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9dea9f1f..4c86c840 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2023-01-27  Jose E. Marchesi  <jemarch@gnu.org>
+
+       * libpoke/pkl-rt.pk (_pkl_print_format_any): Simplify code.
+
 2023-01-27  Jose E. Marchesi  <jemarch@gnu.org>
 
        * libpoke/pkl-typify.c (pkl_typify1_ps_decl): Do not validate
diff --git a/libpoke/pkl-rt.pk b/libpoke/pkl-rt.pk
index 859a4550..8f0a6f47 100644
--- a/libpoke/pkl-rt.pk
+++ b/libpoke/pkl-rt.pk
@@ -1218,16 +1218,13 @@ immutable fun _pkl_print_format_any = (any val,
         }
     }
 
-    if (ctx.pretty_print_p && vm_opprint)
+    /* Use the struct pretty-printer, if it has one defined.  */
+    if (ctx.pretty_print_p
+        && vm_opprint
+        && asm int<32>: ("srefmnt; nn; nip3" : val, "_print"))
     {
-      var struct_has_pp
-        = asm int<32>: ("srefmnt; nn; nip3" : val, "_print");
-
-      if (struct_has_pp)
-        {
-          asm ("srefmnt; nip; call; drop" :: val, "_print");
-          return;
-        }
+      asm ("srefmnt; nip; call; drop" :: val, "_print");
+      return;
     }
 
     var struct_type_name
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]