diff options
| author | Rob Pike <r@golang.org> | 2009-04-17 00:08:24 -0700 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2009-04-17 00:08:24 -0700 |
| commit | aaf63f8d06cda8308eb7c47ebc1f2cf2c1c91d02 (patch) | |
| tree | c20f34ec6f9dea967a511f65b239c5e8637fec8f /src/lib/strconv | |
| parent | 3ea8d854a3a0b7f812d8590d4d1c3c2671288b60 (diff) | |
| download | go-aaf63f8d06cda8308eb7c47ebc1f2cf2c1c91d02.tar.xz | |
Step 1 of the Big Error Shift: make os.Error an interface and replace *os.Errors with os.Errors.
lib/template updated to use new setup; its clients also updated.
Step 2 will make os's error support internally much cleaner.
R=rsc
OCL=27586
CL=27586
Diffstat (limited to 'src/lib/strconv')
| -rw-r--r-- | src/lib/strconv/atof.go | 6 | ||||
| -rw-r--r-- | src/lib/strconv/atof_test.go | 2 | ||||
| -rw-r--r-- | src/lib/strconv/atoi.go | 10 | ||||
| -rw-r--r-- | src/lib/strconv/atoi_test.go | 8 | ||||
| -rw-r--r-- | src/lib/strconv/quote.go | 6 |
5 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/strconv/atof.go b/src/lib/strconv/atof.go index ec94b7c741..c257b2a33e 100644 --- a/src/lib/strconv/atof.go +++ b/src/lib/strconv/atof.go @@ -321,7 +321,7 @@ func decimalAtof32(neg bool, d *decimal, trunc bool) (f float32, ok bool) { // If s is syntactically well-formed but is more than 1/2 ULP // away from the largest floating point number of the given size, // Atof32 returns f = ±Inf, err = os.ERANGE. -func Atof32(s string) (f float32, err *os.Error) { +func Atof32(s string) (f float32, err os.Error) { neg, d, trunc, ok := stringToDecimal(s); if !ok { return 0, os.EINVAL; @@ -342,7 +342,7 @@ func Atof32(s string) (f float32, err *os.Error) { // Atof64 converts the string s to a 64-bit floating-point number. // Except for the type of its result, its definition is the same as that // of Atof32. -func Atof64(s string) (f float64, err *os.Error) { +func Atof64(s string) (f float64, err os.Error) { neg, d, trunc, ok := stringToDecimal(s); if !ok { return 0, os.EINVAL; @@ -361,7 +361,7 @@ func Atof64(s string) (f float64, err *os.Error) { } // Atof is like Atof32 or Atof64, depending on the size of float. -func Atof(s string) (f float, err *os.Error) { +func Atof(s string) (f float, err os.Error) { if FloatSize == 32 { f1, err1 := Atof32(s); return float(f1), err1; diff --git a/src/lib/strconv/atof_test.go b/src/lib/strconv/atof_test.go index 7f1f0a1312..6782f274a2 100644 --- a/src/lib/strconv/atof_test.go +++ b/src/lib/strconv/atof_test.go @@ -13,7 +13,7 @@ import ( type atofTest struct { in string; out string; - err *os.Error; + err os.Error; } var atoftests = []atofTest { diff --git a/src/lib/strconv/atoi.go b/src/lib/strconv/atoi.go index 467c37737c..a5d896a05e 100644 --- a/src/lib/strconv/atoi.go +++ b/src/lib/strconv/atoi.go @@ -29,7 +29,7 @@ func cutoff64(base int) uint64 { // range or s is empty or contains invalid digits. // It returns err == os.ERANGE if the value corresponding // to s cannot be represented by a uint64. -func Btoui64(s string, b int) (n uint64, err *os.Error) { +func Btoui64(s string, b int) (n uint64, err os.Error) { if b < 2 || b > 36 || len(s) < 1 { return 0, os.EINVAL; } @@ -77,7 +77,7 @@ func Btoui64(s string, b int) (n uint64, err *os.Error) { // // Atoui64 returns err == os.EINVAL if s is empty or contains invalid digits. // It returns err == os.ERANGE if s cannot be represented by a uint64. -func Atoui64(s string) (n uint64, err *os.Error) { +func Atoui64(s string) (n uint64, err os.Error) { // Empty string bad. if len(s) == 0 { return 0, os.EINVAL @@ -99,7 +99,7 @@ func Atoui64(s string) (n uint64, err *os.Error) { // Atoi64 is like Atoui64 but allows signed numbers and // returns its result in an int64. -func Atoi64(s string) (i int64, err *os.Error) { +func Atoi64(s string) (i int64, err os.Error) { // Empty string bad. if len(s) == 0 { return 0, os.EINVAL @@ -134,7 +134,7 @@ func Atoi64(s string) (i int64, err *os.Error) { } // Atoui is like Atoui64 but returns its result as a uint. -func Atoui(s string) (i uint, err *os.Error) { +func Atoui(s string) (i uint, err os.Error) { i1, e1 := Atoui64(s); if e1 != nil && e1 != os.ERANGE { return 0, e1 @@ -149,7 +149,7 @@ func Atoui(s string) (i uint, err *os.Error) { } // Atoi is like Atoi64 but returns its result as an int. -func Atoi(s string) (i int, err *os.Error) { +func Atoi(s string) (i int, err os.Error) { i1, e1 := Atoi64(s); if e1 != nil && e1 != os.ERANGE { return 0, e1 diff --git a/src/lib/strconv/atoi_test.go b/src/lib/strconv/atoi_test.go index 3940ebc782..e4a9f955d9 100644 --- a/src/lib/strconv/atoi_test.go +++ b/src/lib/strconv/atoi_test.go @@ -14,7 +14,7 @@ import ( type atoui64Test struct { in string; out uint64; - err *os.Error; + err os.Error; } var atoui64tests = []atoui64Test { @@ -41,7 +41,7 @@ var atoui64tests = []atoui64Test { type atoi64Test struct { in string; out int64; - err *os.Error; + err os.Error; } var atoi64test = []atoi64Test { @@ -71,7 +71,7 @@ var atoi64test = []atoi64Test { type atoui32Test struct { in string; out uint32; - err *os.Error; + err os.Error; } var atoui32tests = []atoui32Test { @@ -91,7 +91,7 @@ var atoui32tests = []atoui32Test { type atoi32Test struct { in string; out int32; - err *os.Error; + err os.Error; } var atoi32tests = []atoi32Test { diff --git a/src/lib/strconv/quote.go b/src/lib/strconv/quote.go index c06204013b..4fcec9a5ea 100644 --- a/src/lib/strconv/quote.go +++ b/src/lib/strconv/quote.go @@ -97,7 +97,7 @@ func unhex(b byte) (v int, ok bool) { return; } -func unquoteChar(s string, i int, q byte) (t string, ii int, err *os.Error) { +func unquoteChar(s string, i int, q byte) (t string, ii int, err os.Error) { err = os.EINVAL; // assume error for easy return // easy cases @@ -190,7 +190,7 @@ func unquoteChar(s string, i int, q byte) (t string, ii int, err *os.Error) { // that s quotes. (If s is single-quoted, it would be a Go // character literal; Unquote returns the corresponding // one-character string.) -func Unquote(s string) (t string, err *os.Error) { +func Unquote(s string) (t string, err os.Error) { err = os.EINVAL; // assume error for easy return n := len(s); if n < 2 || s[0] != s[n-1] { @@ -207,7 +207,7 @@ func Unquote(s string) (t string, err *os.Error) { t := ""; q := s[0]; var c string; - var err *os.Error; + var err os.Error; for i := 1; i < n-1; { c, i, err = unquoteChar(s, i, q); if err != nil { |
