From 94451d7a9cd82e3a7a82424b67f9142504abb6d9 Mon Sep 17 00:00:00 2001 From: Geert-Johan Riemer Date: Mon, 5 May 2014 13:28:48 +0200 Subject: [PATCH] Changed strings.Contains(?, "{") to bytes.IndexOf(?, '{')>-1 --- jsonresults.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index a723d299..6d6fdf5d 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -370,7 +370,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getaddednodeinfo can either return a JSON object or a // slice of strings depending on the verbose flag. Choose the // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { + if bytes.IndexByte(objmap["result"], '{') > -1 { var res []GetAddedNodeInfoResult err = json.Unmarshal(objmap["result"], &res) if err == nil { @@ -393,7 +393,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getblock can either return a JSON object or a hex-encoded // string depending on the verbose flag. Choose the right form // accordingly. - if strings.Contains(string(objmap["result"]), "{") { + if bytes.IndexByte(objmap["result"], '{') > -1 { var res BlockResult err = json.Unmarshal(objmap["result"], &res) if err == nil { @@ -463,7 +463,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getrawmempool can either return a map of JSON objects or // an array of strings depending on the verbose flag. Choose // the right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { + if bytes.IndexByte(objmap["result"], '{') > -1 { var res map[string]GetRawMempoolResult err = json.Unmarshal(objmap["result"], &res) if err == nil { @@ -486,7 +486,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getwork can either return a JSON object or a boolean // depending on whether or not data was provided. Choose the // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { + if bytes.IndexByte(objmap["result"], '{') > -1 { var res GetWorkResult err = json.Unmarshal(objmap["result"], &res) if err == nil {