| 1 |
// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. |
| 2 |
// Use of this source code is governed by a MIT license found in the LICENSE file. |
| 3 |
|
| 4 |
package codec |
| 5 |
|
| 6 |
import "sort" |
| 7 |
|
| 8 |
// TODO: this is brittle, as it depends on z.go's init() being called last. |
| 9 |
// The current build tools all honor that files are passed in lexical order. |
| 10 |
// However, we should consider using an init_channel, |
| 11 |
// that each person doing init will write to. |
| 12 |
|
| 13 |
func init() { |
| 14 |
if !useLookupRecognizedTypes { |
| 15 |
return |
| 16 |
} |
| 17 |
sort.Sort(uintptrSlice(recognizedRtids)) |
| 18 |
sort.Sort(uintptrSlice(recognizedRtidPtrs)) |
| 19 |
recognizedRtidOrPtrs = make([]uintptr, len(recognizedRtids)+len(recognizedRtidPtrs)) |
| 20 |
copy(recognizedRtidOrPtrs, recognizedRtids) |
| 21 |
copy(recognizedRtidOrPtrs[len(recognizedRtids):], recognizedRtidPtrs) |
| 22 |
sort.Sort(uintptrSlice(recognizedRtidOrPtrs)) |
| 23 |
} |