diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-16 15:47:21 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-16 15:47:21 +0000 |
commit | 49b4e44b7d540fa846d353b10237848a67789cbf (patch) | |
tree | ea2b52e3c258d6b6d9356977c683c7f72a4a5fd5 /libgo/go/patch | |
parent | 82ceb8f6a88a0193971f53e0571e017f2764f7d7 (diff) | |
download | gcc-49b4e44b7d540fa846d353b10237848a67789cbf.tar.gz |
Update Go library to r60.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178910 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/patch')
-rw-r--r-- | libgo/go/patch/patch.go | 2 | ||||
-rw-r--r-- | libgo/go/patch/textdiff.go | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libgo/go/patch/patch.go b/libgo/go/patch/patch.go index d4977dc9902..fcc8307e09c 100644 --- a/libgo/go/patch/patch.go +++ b/libgo/go/patch/patch.go @@ -319,4 +319,4 @@ func hasPrefix(s []byte, t string) bool { // splitLines returns the result of splitting s into lines. // The \n on each line is preserved. -func splitLines(s []byte) [][]byte { return bytes.SplitAfter(s, newline, -1) } +func splitLines(s []byte) [][]byte { return bytes.SplitAfter(s, newline) } diff --git a/libgo/go/patch/textdiff.go b/libgo/go/patch/textdiff.go index c7e693fc669..482bd678163 100644 --- a/libgo/go/patch/textdiff.go +++ b/libgo/go/patch/textdiff.go @@ -17,6 +17,8 @@ type TextChunk struct { } func ParseTextDiff(raw []byte) (TextDiff, os.Error) { + var chunkHeader []byte + // Copy raw so it is safe to keep references to slices. _, chunks := sections(raw, "@@ -") delta := 0 @@ -26,13 +28,12 @@ func ParseTextDiff(raw []byte) (TextDiff, os.Error) { // Parse start line: @@ -oldLine,oldCount +newLine,newCount @@ junk chunk := splitLines(raw) - chunkHeader := chunk[0] + chunkHeader = chunk[0] var ok bool var oldLine, oldCount, newLine, newCount int s := chunkHeader if oldLine, s, ok = atoi(s, "@@ -", 10); !ok { - ErrChunkHdr: - return nil, SyntaxError("unexpected chunk header line: " + string(chunkHeader)) + goto ErrChunkHdr } if len(s) == 0 || s[0] != ',' { oldCount = 1 @@ -145,6 +146,9 @@ func ParseTextDiff(raw []byte) (TextDiff, os.Error) { } } return diff, nil + +ErrChunkHdr: + return nil, SyntaxError("unexpected chunk header line: " + string(chunkHeader)) } var ErrPatchFailure = os.NewError("patch did not apply cleanly") |