提交 232d3d74 编写于 作者: D Derek Parker

Prefer "new" for initialization

上级 d5ce94f9
......@@ -50,7 +50,7 @@ func parseLength(ctx *parseContext) parsefunc {
return parseCIE
}
ctx.Frame = &FrameDescriptionEntry{Length: ctx.Length, CIE: ctx.Common, AddressRange: &addrange{}}
ctx.Frame = &FrameDescriptionEntry{Length: ctx.Length, CIE: ctx.Common, AddressRange: new(addrange)}
return parseFDE
}
......
......@@ -35,7 +35,7 @@ type FileEntry struct {
func Parse(data []byte) *DebugLineInfo {
var (
dbl = &DebugLineInfo{}
dbl = new(DebugLineInfo)
buf = bytes.NewBuffer(data)
)
......@@ -48,7 +48,7 @@ func Parse(data []byte) *DebugLineInfo {
}
func parseDebugLinePrologue(dbl *DebugLineInfo, buf *bytes.Buffer) {
p := &DebugLinePrologue{}
p := new(DebugLinePrologue)
p.Length = binary.LittleEndian.Uint32(buf.Next(4))
p.Version = binary.LittleEndian.Uint16(buf.Next(2))
......@@ -78,7 +78,7 @@ func parseIncludeDirs(info *DebugLineInfo, buf *bytes.Buffer) {
func parseFileEntries(info *DebugLineInfo, buf *bytes.Buffer) {
for {
entry := FileEntry{}
entry := new(FileEntry)
name, _ := util.ParseString(buf)
if name == "" {
......@@ -90,6 +90,6 @@ func parseFileEntries(info *DebugLineInfo, buf *bytes.Buffer) {
entry.LastModTime, _ = util.DecodeULEB128(buf)
entry.Length, _ = util.DecodeULEB128(buf)
info.FileNames = append(info.FileNames, &entry)
info.FileNames = append(info.FileNames, entry)
}
}
......@@ -82,7 +82,7 @@ func NewDebugProcess(pid int) (*DebuggedProcess, error) {
debuggedProc := DebuggedProcess{
Pid: pid,
Regs: &syscall.PtraceRegs{},
Regs: new(syscall.PtraceRegs),
Process: proc,
ProcessState: ps,
BreakPoints: make(map[string]*BreakPoint),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册