[Pkg-gnupg-commit] [gnupg2] 38/132: gpgscm: Make tags mandatory.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 17 03:07:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit a1ad5d6a30cf72d9b7e7bb449985dc69d5e01c4b
Author: Justus Winter <justus at g10code.com>
Date:   Wed Mar 29 18:05:33 2017 +0200

    gpgscm: Make tags mandatory.
    
    * tests/gpgscm/opdefines.h: Make tags mandatory.
    * tests/gpgscm/scheme.c: Likewise.
    * tests/gpgscm/scheme.h: Likewise.
    --
    
    Tags provide a constant-time lookup mechanism for almost every object.
    This is useful for the interpreter itself, and the code for tags is
    tiny.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/gpgscm/opdefines.h |  2 --
 tests/gpgscm/scheme.c    | 16 ++--------------
 tests/gpgscm/scheme.h    |  6 ------
 3 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/tests/gpgscm/opdefines.h b/tests/gpgscm/opdefines.h
index dd32d1e..61f7971 100644
--- a/tests/gpgscm/opdefines.h
+++ b/tests/gpgscm/opdefines.h
@@ -154,11 +154,9 @@ _OP_DEF("append",                         0,  INF_ARG, TST_NONE,
 _OP_DEF("set-symbol-property!",           3,  3,       TST_SYMBOL TST_SYMBOL TST_ANY,   OP_SET_SYMBOL_PROPERTY )
 _OP_DEF("symbol-property",                2,  2,       TST_SYMBOL TST_SYMBOL,           OP_SYMBOL_PROPERTY  )
 #endif
-#if USE_TAGS
 _OP_DEF(0,                                0,  0,       TST_NONE,                        OP_TAG_VALUE        )
 _OP_DEF("make-tagged-value",              2,  2,       TST_ANY TST_PAIR,                 OP_MK_TAGGED        )
 _OP_DEF("get-tag",                        1,  1,       TST_ANY,                         OP_GET_TAG          )
-#endif
 _OP_DEF("quit",                           0,  1,       TST_NUMBER,                      OP_QUIT             )
 _OP_DEF("gc",                             0,  0,       0,                               OP_GC               )
 _OP_DEF("gc-verbose",                     0,  1,       TST_NONE,                        OP_GCVERB           )
diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index f3a99fd..fa089a0 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -671,8 +671,6 @@ copy_value(scheme *sc, pointer dst, pointer src)
 /* Tags are like property lists, but can be attached to arbitrary
  * values.  */
 
-#if USE_TAGS
-
 static pointer
 mk_tagged_value(scheme *sc, pointer v, pointer tag_car, pointer tag_cdr)
 {
@@ -709,14 +707,6 @@ get_tag(scheme *sc, pointer v)
   return sc->NIL;
 }
 
-#else
-
-#define mk_tagged_value(SC, X, A, B)	(X)
-#define has_tag(V)			0
-#define get_tag(SC, V)			(SC)->NIL
-
-#endif
-
 

 
 /* Low-level allocator.
@@ -4718,7 +4708,6 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
 	  s_return(sc, get_property(sc, car(sc->args), cadr(sc->args)));
 #endif /* USE_PLIST */
 
-#if USE_TAGS
      CASE(OP_TAG_VALUE): {      /* not exposed */
 	  /* This tags sc->value with car(sc->args).  Useful to tag
 	   * results of opcode evaluations.  */
@@ -4738,7 +4727,6 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
 
      CASE(OP_GET_TAG):        /* get-tag */
 	  s_return(sc, get_tag(sc, car(sc->args)));
-#endif /* USE_TAGS */
 
      CASE(OP_QUIT):       /* quit */
           if(is_pair(sc->args)) {
@@ -4927,12 +4915,12 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) {
                } else if (sc->tok == TOK_DOT) {
                     Error_0(sc,"syntax error: illegal dot expression");
                } else {
-#if USE_TAGS && SHOW_ERROR_LINE
+#if SHOW_ERROR_LINE
 		    pointer filename;
 		    pointer lineno;
 #endif
                     sc->nesting_stack[sc->file_i]++;
-#if USE_TAGS && SHOW_ERROR_LINE
+#if SHOW_ERROR_LINE
 		    filename = sc->load_stack[sc->file_i].filename;
 		    lineno = sc->load_stack[sc->file_i].curr_line;
 
diff --git a/tests/gpgscm/scheme.h b/tests/gpgscm/scheme.h
index 8560f7d..d748186 100644
--- a/tests/gpgscm/scheme.h
+++ b/tests/gpgscm/scheme.h
@@ -44,7 +44,6 @@ extern "C" {
 # define USE_DL 0
 # define USE_PLIST 0
 # define USE_SMALL_INTEGERS 0
-# define USE_TAGS 0
 # define USE_HISTORY 0
 #endif
 
@@ -78,11 +77,6 @@ extern "C" {
 # define USE_PLIST 0
 #endif
 
-/* If set, then every object can be tagged.  */
-#ifndef USE_TAGS
-# define USE_TAGS 1
-#endif
-
 /* Keep a history of function calls.  This enables a feature similar
  * to stack traces.  */
 #ifndef USE_HISTORY

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list