poke-devel
[Top][All Lists]
Advanced

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

[PATCH] libpoke: add missing checks for term_if functions


From: Mohammad-Reza Nabipoor
Subject: [PATCH] libpoke: add missing checks for term_if functions
Date: Thu, 28 Sep 2023 15:56:45 +0200

2023-09-25  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>

        * libpoke/libpoke.c (pk_compiler_new_with_flags): Add checks for
        presence of user-provided function pointers for the terminal
        interface.
        * testsuite/poke.libpoke/api.c (test_pk_compiler_new): Update tests.
---
 ChangeLog                    |  7 +++++++
 libpoke/libpoke.c            |  4 +++-
 testsuite/poke.libpoke/api.c | 14 +++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 498e34ee..23b2a8f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-09-25  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
+
+       * libpoke/libpoke.c (pk_compiler_new_with_flags): Add checks for
+       presence of user-provided function pointers for the terminal
+       interface.
+       * testsuite/poke.libpoke/api.c (test_pk_compiler_new): Update tests.
+
 2023-09-23  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
 
        * etc/hacking.org (Maintainers): Update.
diff --git a/libpoke/libpoke.c b/libpoke/libpoke.c
index 8d542ce0..10b4be6d 100644
--- a/libpoke/libpoke.c
+++ b/libpoke/libpoke.c
@@ -60,7 +60,9 @@ pk_compiler_new_with_flags (struct pk_term_if *term_if, 
uint32_t flags)
 
   if (!term_if->flush_fn || !term_if->puts_fn || !term_if->printf_fn
       || !term_if->indent_fn || !term_if->class_fn || !term_if->end_class_fn
-      || !term_if->hyperlink_fn || !term_if->end_hyperlink_fn)
+      || !term_if->hyperlink_fn || !term_if->end_hyperlink_fn
+      || !term_if->get_color_fn || !term_if->get_bgcolor_fn
+      || !term_if->set_color_fn || !term_if->set_bgcolor_fn)
     return NULL;
 
   pkc = calloc (1, sizeof (struct _pk_compiler));
diff --git a/testsuite/poke.libpoke/api.c b/testsuite/poke.libpoke/api.c
index c37dfde8..906998b1 100644
--- a/testsuite/poke.libpoke/api.c
+++ b/testsuite/poke.libpoke/api.c
@@ -83,8 +83,20 @@ test_pk_compiler_new (void)
   TT (10);
 
   tif.end_hyperlink_fn = poke_term_if.end_hyperlink_fn;
+  TT (11);
+
+  tif.get_color_fn = poke_term_if.get_color_fn;
+  TT (12);
+
+  tif.get_bgcolor_fn = poke_term_if.get_bgcolor_fn;
+  TT (13);
+
+  tif.set_color_fn = poke_term_if.set_color_fn;
+  TT (14);
+
+  tif.set_bgcolor_fn = poke_term_if.set_bgcolor_fn;
   pkc = pk_compiler_new (&tif);
-  T ("pk_compiler_new_11", pkc != NULL);
+  T ("pk_compiler_new_15", pkc != NULL);
 
 #undef TT
 
-- 
2.42.0




reply via email to

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