Use Unsafe rather than Dangerous to be consistent

This commit is contained in:
Kovid Goyal
2022-09-02 13:34:48 +05:30
parent 081390b5a2
commit a7f6105393
4 changed files with 11 additions and 11 deletions

View File

@@ -172,7 +172,7 @@ func (self *Loop) QueueWriteString(data string) IdType {
// This is dangerous as it is upto the calling code
// to ensure the data in the underlying array does not change
func (self *Loop) QueueWriteBytesDangerous(data []byte) IdType {
func (self *Loop) UnsafeQueueWriteBytes(data []byte) IdType {
self.write_msg_id_counter++
msg := write_msg{bytes: data, id: self.write_msg_id_counter}
self.add_write_to_pending_queue(&msg)
@@ -182,7 +182,7 @@ func (self *Loop) QueueWriteBytesDangerous(data []byte) IdType {
func (self *Loop) QueueWriteBytesCopy(data []byte) IdType {
d := make([]byte, len(data))
copy(d, data)
return self.QueueWriteBytesDangerous(d)
return self.UnsafeQueueWriteBytes(d)
}
func (self *Loop) ExitCode() int {