Skip to content

Commit

Permalink
fix: mesgdef should clear array pool directly (#479)
Browse files Browse the repository at this point in the history
* fix: mesgdef should clear array pool directly

* fitgen: generate mesgdef
  • Loading branch information
muktihari authored Oct 4, 2024
1 parent b85b163 commit 405d6b0
Show file tree
Hide file tree
Showing 120 changed files with 240 additions and 240 deletions.
4 changes: 2 additions & 2 deletions internal/cmd/fitgen/profile/mesgdef/mesgdef.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func New{{ .Name }}(mesg *proto.Message) *{{ .Name }} {
vals[mesg.Fields[i].Num] = mesg.Fields[i].Value
}
unknownFields = sliceutil.Clone(unknownFields)
clear(arr[:len(unknownFields)]) {{/* In case of unknown field or field.Value contains pointer to a slice */}}
*arr = [poolsize]proto.Field{} {{/* In case of unknown field or field.Value contains pointer to a slice */}}
pool.Put(arr)
{{- if and (not (eq .Name "FileId")) (not (eq .Name "DeveloperDataId")) (not (eq .Name "FieldDescription")) }}
developerFields = mesg.DeveloperFields
Expand Down Expand Up @@ -133,7 +133,7 @@ func (m *{{ .Name }}) ToMesg(options *Options) proto.Message {

mesg.Fields = make([]proto.Field, len(fields))
copy(mesg.Fields, fields)
clear(fields) {{/* In case of unknown field or field.Value contains pointer to a slice */}}
*arr = [poolsize]proto.Field{} {{/* In case of unknown field or field.Value contains pointer to a slice */}}
pool.Put(arr)

{{ if and (not (eq .Name "FileId")) (not (eq .Name "DeveloperDataId")) (not (eq .Name "FieldDescription")) }}
Expand Down
4 changes: 2 additions & 2 deletions profile/mesgdef/aad_accel_features_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/accelerometer_data_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/activity_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/ant_channel_id_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/ant_rx_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/ant_tx_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/aviation_attitude_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/barometer_data_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/beat_intervals_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/bike_profile_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/blood_pressure_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/cadence_zone_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/camera_event_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/capabilities_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/chrono_shot_data_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/chrono_shot_session_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/climb_pro_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/connectivity_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/course_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/course_point_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions profile/mesgdef/developer_data_id_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 405d6b0

Please sign in to comment.