PushNullTerminatedByteSlice writes bs to the stack, followed by an extra null byte at the end. On error, the contents of the stack and the bottom cursor are undefined.
(bs []byte)
| 105 | // byte at the end. On error, the contents of the stack and the bottom cursor |
| 106 | // are undefined. |
| 107 | func (s *Stack) PushNullTerminatedByteSlice(bs []byte) (int, error) { |
| 108 | // Note: Stack grows up, so write the terminal null byte first. |
| 109 | nNull, err := primitive.CopyUint8Out(s, StackBottomMagic, 0) |
| 110 | if err != nil { |
| 111 | return 0, err |
| 112 | } |
| 113 | n, err := primitive.CopyByteSliceOut(s, StackBottomMagic, bs) |
| 114 | if err != nil { |
| 115 | return 0, err |
| 116 | } |
| 117 | return n + nNull, nil |
| 118 | } |
| 119 | |
| 120 | // StackLayout describes the location of the arguments and environment on the |
| 121 | // stack. |
no test coverage detected