llcppsigfetch:json memory free
This commit is contained in:
@@ -22,9 +22,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"github.com/goplus/llgo/c"
|
"github.com/goplus/llgo/c"
|
||||||
|
"github.com/goplus/llgo/c/cjson"
|
||||||
"github.com/goplus/llgo/chore/_xtool/llcppsigfetch/parse"
|
"github.com/goplus/llgo/chore/_xtool/llcppsigfetch/parse"
|
||||||
"github.com/goplus/llgo/chore/_xtool/llcppsymg/config"
|
"github.com/goplus/llgo/chore/_xtool/llcppsymg/config"
|
||||||
)
|
)
|
||||||
@@ -78,7 +78,9 @@ func getHeaderFiles(cflags string, files []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func outputInfo(context *parse.Context) {
|
func outputInfo(context *parse.Context) {
|
||||||
output := context.Output().Print()
|
info := context.Output()
|
||||||
defer c.Free(unsafe.Pointer(output))
|
str := info.Print()
|
||||||
c.Printf(output)
|
defer cjson.FreeCStr(str)
|
||||||
|
defer info.Delete()
|
||||||
|
c.Printf(str)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cvttest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/goplus/llgo/c"
|
"github.com/goplus/llgo/c"
|
||||||
|
"github.com/goplus/llgo/c/cjson"
|
||||||
"github.com/goplus/llgo/chore/_xtool/llcppsigfetch/parse"
|
"github.com/goplus/llgo/chore/_xtool/llcppsigfetch/parse"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,9 +21,12 @@ func RunTest(testName string, testCases []string) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
json := converter.MarshalASTFiles()
|
result := converter.MarshalASTFiles()
|
||||||
c.Printf(c.Str("%s Case %d:\n%s\n\n"), c.AllocaCStr(testName), c.Int(i+1), json.Print())
|
str := result.Print()
|
||||||
|
c.Printf(c.Str("%s Case %d:\n%s\n\n"), c.AllocaCStr(testName), c.Int(i+1), str)
|
||||||
|
|
||||||
|
cjson.FreeCStr(str)
|
||||||
|
result.Delete()
|
||||||
converter.Dispose()
|
converter.Dispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user