[git] GnuPG - branch, master, updated. gnupg-2.1.15-322-g1f45878

by Justus Winter cvs at cvs.gnupg.org
Fri Nov 4 13:51:36 CET 2016


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 "The GNU Privacy Guard".

The branch, master has been updated
       via  1f45878a72f23d4bae08d73b614096b485f35274 (commit)
       via  43f8006f5c75e3d15fe200e2fa41587a73bfb07b (commit)
      from  cd00b07ec26c3408e6aee66957b08c6fd319b700 (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 -----------------------------------------------------------------
commit 1f45878a72f23d4bae08d73b614096b485f35274
Author: Justus Winter <justus at g10code.com>
Date:   Fri Nov 4 13:45:30 2016 +0100

    gpgscm: Fix printing strings containing zero bytes.
    
    * tests/gpgscm/scheme.c (atom2str): Fix computing the length of Scheme
    strings.  Scheme strings can contain zero bytes.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 0e31dc5..44dd165 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -2041,7 +2041,9 @@ static void atom2str(scheme *sc, pointer l, int f, char **pp, int *plen) {
           }
      } else if (is_string(l)) {
           if (!f) {
-               p = strvalue(l);
+               *pp = strvalue(l);
+	       *plen = strlength(l);
+	       return;
           } else { /* Hack, uses the fact that printing is needed */
                *pp=sc->strbuff;
                *plen=0;

commit 43f8006f5c75e3d15fe200e2fa41587a73bfb07b
Author: Justus Winter <justus at g10code.com>
Date:   Fri Nov 4 12:08:20 2016 +0100

    gpgscm: Implement 'atexit'.
    
    * tests/gpgscm/ffi.scm (throw): Run *run-atexit-handlers* when
    terminating the interpreter.
    (*atexit-handlers*): New variable.
    (*run-atexit-handlers*): New function.
    (atexit): Likewise.
    * tests/gpgscm/main.c (main): Run *run-atexit-handlers* at normal
    interpreter shutdown.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/ffi.scm b/tests/gpgscm/ffi.scm
index 72a2a8f..fb18538 100644
--- a/tests/gpgscm/ffi.scm
+++ b/tests/gpgscm/ffi.scm
@@ -57,6 +57,7 @@
    ((more-handlers?)
     (apply (pop-handler) x))
    ((and (= 2 (length x)) (equal? *interpreter-exit* (car x)))
+    (*run-atexit-handlers*)
     (_exit (cadr x)))
    (else
     (apply error x))))
@@ -64,3 +65,20 @@
 ;; Terminate the process returning STATUS to the parent.
 (define (exit status)
   (throw *interpreter-exit* status))
+
+;; A list of functions run at interpreter shutdown.
+(define *atexit-handlers* (list))
+
+;; Execute all these functions.
+(define (*run-atexit-handlers*)
+  (unless (null? *atexit-handlers*)
+	  (let ((proc (car *atexit-handlers*)))
+	    ;; Drop proc from the list so that it will not get
+	    ;; executed again even if it raises an exception.
+	    (set! *atexit-handlers* (cdr *atexit-handlers*))
+	    (proc)
+	    (*run-atexit-handlers*))))
+
+;; Register a function to be run at interpreter shutdown.
+(define (atexit proc)
+  (set! *atexit-handlers* (cons proc *atexit-handlers*)))
diff --git a/tests/gpgscm/main.c b/tests/gpgscm/main.c
index f7c6b0d..70ce855 100644
--- a/tests/gpgscm/main.c
+++ b/tests/gpgscm/main.c
@@ -291,6 +291,7 @@ main (int argc, char **argv)
         log_fatal ("%s: %s", script, gpg_strerror (err));
     }
 
+  scheme_load_string (sc, "(*run-atexit-handlers*)");
   scheme_deinit (sc);
   xfree (sc);
   return EXIT_SUCCESS;

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

Summary of changes:
 tests/gpgscm/ffi.scm  | 18 ++++++++++++++++++
 tests/gpgscm/main.c   |  1 +
 tests/gpgscm/scheme.c |  4 +++-
 3 files changed, 22 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list