From bd314801c3b4cb8f1e0d404d13a083c9228110c2 Mon Sep 17 00:00:00 2001 From: stephen Date: Tue, 22 Jun 2010 07:37:46 -0400 Subject: [PATCH] Removed firstIndex and replaced with strings.IndexAny --- conf.go | 11 ----------- read.go | 4 ++-- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/conf.go b/conf.go index b22758a..eb8c1dd 100644 --- a/conf.go +++ b/conf.go @@ -160,17 +160,6 @@ func NewConfigFile() *ConfigFile { return c } -func firstIndex(s string, delim []byte) int { - for i := 0; i < len(s); i++ { - for j := 0; j < len(delim); j++ { - if s[i] == delim[j] { - return i - } - } - } - return -1 -} - type GetError struct { Reason int ValueType string diff --git a/read.go b/read.go index a731f82..ee7658e 100644 --- a/read.go +++ b/read.go @@ -84,10 +84,10 @@ func (c *ConfigFile) Read(reader io.Reader) (err os.Error) { return ReadError{BlankSection, l} default: // other alternatives - i := firstIndex(l, []byte{'=', ':'}) + i := strings.IndexAny(l, "=:") switch { case i > 0: // option and value - i := firstIndex(l, []byte{'=', ':'}) + i := strings.IndexAny(l, "=:") option = strings.TrimSpace(l[0:i]) value := strings.TrimSpace(stripComments(l[i+1:])) c.AddOption(section, option, value)