[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/01: [gnugo int] Add abstraction: gnugo--compare-strings
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 01/01: [gnugo int] Add abstraction: gnugo--compare-strings |
Date: |
Mon, 10 Mar 2014 10:07:52 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit c9e64150ffca45572fa6cc1ae4d50f5bdd467f05
Author: Thien-Thi Nguyen <address@hidden>
Date: Mon Mar 10 11:11:55 2014 +0100
[gnugo int] Add abstraction: gnugo--compare-strings
* packages/gnugo/gungo.el (gnugo--compare-strings): New defsubst.
(gnugo--q, gnugo-merge-showboard-results): Use it.
---
packages/gnugo/gnugo.el | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 917579c..578fc81 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -173,6 +173,9 @@ For ~t, the value is a snapshot, use `gnugo-refresh' to
update it.")
;;;---------------------------------------------------------------------------
;;; Support functions
+(defsubst gnugo--compare-strings (s1 beg1 s2 beg2)
+ (compare-strings s1 beg1 nil s2 beg2 nil))
+
(defun gnugo-put (key value)
"Associate move/game/board-specific property KEY with VALUE.
@@ -343,11 +346,10 @@ status of the command. See also `gnugo-query'."
(let ((full (concat (process-get proc :srs)
string)))
(process-put proc :srs full)
- (unless (numberp (compare-strings
+ (unless (numberp (gnugo--compare-strings
full (max 0 (- (length full)
2))
- nil
- "\n\n" nil nil))
+ "\n\n" nil))
(process-put proc :incomplete nil))))
(if (null args)
fmt
@@ -563,8 +565,9 @@ when you are sure the command cannot fail."
(bef-start 0) (bef-idx 0)
(aft-start 0) (aft-idx 0)
aft-sync-backtrack mis inc cut new very-strange)
- (while (numberp (setq mis (compare-strings bef bef-start nil
- aft aft-start nil)))
+ (while (numberp (setq mis (gnugo--compare-strings
+ bef bef-start
+ aft aft-start)))
(setq aft-sync-backtrack nil
inc (if (cl-minusp mis)
(- (+ 1 mis))