[template-glib] expr-eval: cleanup builtin defines



commit 9b44da6720dfa664bfcbac8c5a552bf723f8fd65
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 6 15:20:03 2022 -0700

    expr-eval: cleanup builtin defines

 src/tmpl-expr-eval.c | 59 +++++++++++++++-------------------------------------
 1 file changed, 17 insertions(+), 42 deletions(-)
---
diff --git a/src/tmpl-expr-eval.c b/src/tmpl-expr-eval.c
index 3a60305..d6280b6 100644
--- a/src/tmpl-expr-eval.c
+++ b/src/tmpl-expr-eval.c
@@ -29,6 +29,9 @@
 #include "tmpl-symbol.h"
 #include "tmpl-util-private.h"
 
+#define DECLARE_BUILTIN(name) \
+  static gboolean builtin_##name (const GValue *, GValue *, GError **);
+
 typedef gboolean (*BuiltinFunc)  (const GValue  *value,
                                   GValue        *return_value,
                                   GError       **error);
@@ -45,48 +48,6 @@ static gboolean throw_type_mismatch          (GError       **error,
                                               const GValue  *left,
                                               const GValue  *right,
                                               const gchar   *message);
-static gboolean builtin_abs                  (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_assert               (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_ceil                 (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_floor                (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_hex                  (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_log                  (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_print                (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_printerr             (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_repr                 (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_sqrt                 (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_sin                  (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_tan                  (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_cos                  (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
-static gboolean builtin_typeof               (const GValue  *value,
-                                              GValue        *return_value,
-                                              GError       **error);
 static gboolean eq_enum_string               (const GValue  *left,
                                               const GValue  *right,
                                               GValue        *return_value,
@@ -100,6 +61,20 @@ static gboolean add_string_string_slow       (const GValue  *left,
                                               GValue        *return_value,
                                               GError       **error);
 
+DECLARE_BUILTIN (abs)
+DECLARE_BUILTIN (assert)
+DECLARE_BUILTIN (ceil)
+DECLARE_BUILTIN (floor)
+DECLARE_BUILTIN (hex)
+DECLARE_BUILTIN (log)
+DECLARE_BUILTIN (print)
+DECLARE_BUILTIN (printerr)
+DECLARE_BUILTIN (repr)
+DECLARE_BUILTIN (sqrt)
+DECLARE_BUILTIN (sin)
+DECLARE_BUILTIN (tan)
+DECLARE_BUILTIN (cos)
+DECLARE_BUILTIN (typeof)
 static GHashTable *fast_dispatch;
 static BuiltinFunc builtin_funcs [] = {
   builtin_abs,


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