This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 63a5849cd9995e510dbde8cadbd3fa95b09c876c Author: Sebastian Rühl <sru...@apache.org> AuthorDate: Tue Apr 20 14:43:46 2021 +0200 plc4go: small optimization in ReadBufferXmlBased.go --- plc4go/internal/plc4go/spi/utils/ReadBufferXmlBased.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plc4go/internal/plc4go/spi/utils/ReadBufferXmlBased.go b/plc4go/internal/plc4go/spi/utils/ReadBufferXmlBased.go index 50d43ac..3de63dc 100644 --- a/plc4go/internal/plc4go/spi/utils/ReadBufferXmlBased.go +++ b/plc4go/internal/plc4go/spi/utils/ReadBufferXmlBased.go @@ -241,8 +241,6 @@ func (x *xmlReadBuffer) move(bits uint8) { } func (x *xmlReadBuffer) travelToNextStartElement() (xml.StartElement, error) { - var startElement xml.StartElement -findTheStartToken: for { token, err := x.Token() if err != nil { @@ -250,13 +248,11 @@ findTheStartToken: } switch token.(type) { case xml.StartElement: - startElement = token.(xml.StartElement) - break findTheStartToken + return token.(xml.StartElement), nil case xml.EndElement: return xml.StartElement{}, errors.Errorf("unexpected end element %s", token.(xml.EndElement).Name) } } - return startElement, nil } func (x *xmlReadBuffer) travelToNextEndElement() (xml.EndElement, error) {