gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, extgawk, updated. 7c209cbe1b2fd054769512


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, extgawk, updated. 7c209cbe1b2fd054769512e325ede72d865f0c84
Date: Thu, 12 Jul 2012 19:56:30 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, extgawk has been updated
       via  7c209cbe1b2fd054769512e325ede72d865f0c84 (commit)
      from  28daef44c3c08f16002c678319a30b816f6972fd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=7c209cbe1b2fd054769512e325ede72d865f0c84

commit 7c209cbe1b2fd054769512e325ede72d865f0c84
Author: Arnold D. Robbins <address@hidden>
Date:   Thu Jul 12 22:56:09 2012 +0300

    Simplify code in testext.c.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index ce8d6b7..e71d071 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -7,6 +7,11 @@
        * fnmatch.c (init_fnmatch): Use sym_constant for FNM_NOMATCH.
        * testext.c (dl_load): Use sym_constant for answer_num.
 
+       * testext.c (init_testext): Move extra code to here.
+       (init_func): Change to point to init_testext.
+       (dl_load): Deleted.
+       (dl_load_func): Use the macro.
+
 2012-07-11         Arnold D. Robbins     <address@hidden>
 
        * filefuncs.c (array_set, do_stat): Use make_const_string.
diff --git a/extension/testext.c b/extension/testext.c
index dc3002a..0eff62b 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -39,7 +39,6 @@
 
 static const gawk_api_t *api;  /* for convenience macros to work */
 static awk_ext_id_t *ext_id;
-static awk_bool_t (*init_func)(void) = NULL;
 
 int plugin_is_GPL_compatible;
 
@@ -577,36 +576,13 @@ static awk_ext_func_t func_table[] = {
        { "print_do_lint", print_do_lint, 0 },
 };
 
-/* dl_load --- extension load routine, called from gawk */
+/* init_testext --- additional initialization function */
 
-int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id)
+static awk_bool_t init_testext(void)
 {
-       size_t i, j;
-       int errors = 0;
        awk_value_t value;
        static const char message[] = "hello, world";   /* of course */
 
-       api = api_p;
-       ext_id = id;
-
-       if (api->major_version != GAWK_API_MAJOR_VERSION
-           || api->minor_version < GAWK_API_MINOR_VERSION) {
-               fprintf(stderr, "testfuncs: version mismatch with gawk!\n");
-               fprintf(stderr, "\tmy version (%d, %d), gawk version (%d, 
%d)\n",
-                       GAWK_API_MAJOR_VERSION, GAWK_API_MINOR_VERSION,
-                       api->major_version, api->minor_version);
-               exit(1);
-       }
-
-       /* load functions */
-       for (i = 0, j = sizeof(func_table) / sizeof(func_table[0]); i < j; i++) 
{
-               if (! add_ext_func(& func_table[i], "")) {
-                       warning(ext_id, "testfuncs: could not add %s\n",
-                                       func_table[i].name);
-                       errors++;
-               }
-       }
-
        /* add at_exit functions */
        awk_atexit(at_exit0, NULL);
        awk_atexit(at_exit1, & data_for_1);
@@ -632,5 +608,9 @@ BEGIN {
 
        create_new_array();
 
-       return (errors == 0);
+       return 1;
 }
+
+static awk_bool_t (*init_func)(void) = init_testext;
+
+dl_load_func(func_table, testext, "")

-----------------------------------------------------------------------

Summary of changes:
 extension/ChangeLog |    5 +++++
 extension/testext.c |   34 +++++++---------------------------
 2 files changed, 12 insertions(+), 27 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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