[Pkg-gnupg-commit] [gnupg2] 152/180: gpgscm: Change associativity of ::.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Dec 24 22:29:21 UTC 2016


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

dkg pushed a commit to branch master
in repository gnupg2.

commit a45dc0849da0d944ec8c759bc8e3e733b1eb0079
Author: Justus Winter <justus at g10code.com>
Date:   Mon Dec 19 15:29:07 2016 +0100

    gpgscm: Change associativity of ::.
    
    * tests/gpgscm/scheme.c (mk_atom): Change associativity of the ::
    infix-operator.  This makes it possible to naturally express accessing
    nested structures (e.g. a::b::c).
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/gpgscm/scheme.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 3abe12a..a5b7691 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -1409,14 +1409,23 @@ static pointer mk_atom(scheme *sc, char *q) {
      int has_fp_exp = 0;
 
 #if USE_COLON_HOOK
-     if((p=strstr(q,"::"))!=0) {
+     char *next;
+     next = p = q;
+     while ((next = strstr(next, "::")) != 0) {
+	  /* Keep looking for the last occurrence.  */
+	  p = next;
+	  next = next + 2;
+     }
+
+     if (p != q) {
           *p=0;
           return cons(sc, sc->COLON_HOOK,
                           cons(sc,
                               cons(sc,
                                    sc->QUOTE,
-                                   cons(sc, mk_atom(sc,p+2), sc->NIL)),
-                              cons(sc, mk_symbol(sc,strlwr(q)), sc->NIL)));
+                                   cons(sc, mk_symbol(sc, strlwr(p + 2)),
+					sc->NIL)),
+                              cons(sc, mk_atom(sc, q), sc->NIL)));
      }
 #endif
 

-- 
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