Commit Graph

3 Commits (abc337a07c1c3b9b624318f23b098341d6c205d7)

Author SHA1 Message Date
Cuong Manh Le 51ff6f7b5c
fix: misuse of reflect.SliceHeader (#19875)
Currently, unsafeBytesToString function violates the 6th rule of unsafe
pointer usage. That is, reflect.SliceHeader/String header should never
be used as plain struct. This misuse can make to silent memory
corruption, which can be difficult to track down when problem occurred.

Instead, use the more (right) idiom to convert slice of byte to string
without heap allocation.

goos: linux
goarch: amd64
cpu: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
BenchmarkInvalid-8   	1000000000	         0.497 ns/op	       0 B/op	       0 allocs/op
BenchmarkValid-8     	1000000000	         0.239 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	command-line-arguments	0.815s
2020-11-09 09:37:20 -05:00
Mark Rushakoff d73d73c0d4 chore: rename imports from platform to influxdb
I did this with a dumb editor macro, so some comments changed too.

Also rename root package from platform to influxdb.

In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.

Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
2019-01-09 20:51:47 -08:00
Edd Robinson 04818c7859 Initial import of models package 2018-10-01 12:03:19 +01:00