z.go 826 B

1234567891011121314151617181920212223
  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. package codec
  4. import "sort"
  5. // TODO: this is brittle, as it depends on z.go's init() being called last.
  6. // The current build tools all honor that files are passed in lexical order.
  7. // However, we should consider using an init_channel,
  8. // that each person doing init will write to.
  9. func init() {
  10. if !useLookupRecognizedTypes {
  11. return
  12. }
  13. sort.Sort(uintptrSlice(recognizedRtids))
  14. sort.Sort(uintptrSlice(recognizedRtidPtrs))
  15. recognizedRtidOrPtrs = make([]uintptr, len(recognizedRtids)+len(recognizedRtidPtrs))
  16. copy(recognizedRtidOrPtrs, recognizedRtids)
  17. copy(recognizedRtidOrPtrs[len(recognizedRtids):], recognizedRtidPtrs)
  18. sort.Sort(uintptrSlice(recognizedRtidOrPtrs))
  19. }