Commits

evhan committed e3c7f36

add string-index, remove dependency on srfi-13

Comments (0)

Files changed (1)

 ;;; See git.scm for a cleaner, high-level API.
 ;;;
 
-(require-library foreigners lolevel srfi-13 srfi-69)
+(require-library foreigners lolevel srfi-69)
 
 (module git-lolevel ()
   (import scheme foreigners lolevel srfi-69)
   (import foreign)
-  (import (only srfi-13 string-index))
   (import (except chicken repository-path))
   (include "git-lolevel-exports.scm")
 
      (lambda () (proc callback))
      (lambda () (callback-unregister! callback)))))
 
+;;;
+;;; Other helpers.
+;;;
+
+;; This is here in order to avoid requiring srfi-13.
+(define (string-index s c)
+  (let ((len (string-length s)))
+    (let lp ((i 0))
+      (cond ((= i len) #f)
+            ((char=? (string-ref s i) c) i)
+            (else (lp (+ i 1)))))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; git2.h