1
0
mirror of https://github.com/golang/go synced 2024-09-29 19:14:28 -06:00

renamed filterParamName to exportParamName, fixed some issues in the documentation for the function

This commit is contained in:
Nathan Fiscaletti 2020-03-09 16:42:14 -05:00
parent c39651d57f
commit e9d72252f8

View File

@ -803,12 +803,12 @@ func (p *Package) packedAttribute() string {
return s + "))"
}
// filterParamName returns the value of param as it should be
// displayed in a c header file. if param contains any non-ASCII
// exportParamName returns the value of param as it should be
// displayed in a c header file. If param contains any non-ASCII
// characters, this function will return the character p followed by
// the value of position; otherwise, this function will return the
// value of param.
func filterParamName(param string, position int) string {
func exportParamName(param string, position int) string {
pname := param
for i := 0; i < len(param); i++ {
@ -934,7 +934,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
if i > 0 || fn.Recv != nil {
s += ", "
}
s += fmt.Sprintf("%s %s", p.cgoType(atype).C, filterParamName(aname, i))
s += fmt.Sprintf("%s %s", p.cgoType(atype).C, exportParamName(aname, i))
})
s += ")"
@ -960,7 +960,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
}
forFieldList(fntype.Params,
func(i int, aname string, atype ast.Expr) {
fmt.Fprintf(fgcc, "\ta.p%d = %s;\n", i, filterParamName(aname, i))
fmt.Fprintf(fgcc, "\ta.p%d = %s;\n", i, exportParamName(aname, i))
})
fmt.Fprintf(fgcc, "\t_cgo_tsan_release();\n")
fmt.Fprintf(fgcc, "\tcrosscall2(_cgoexp%s_%s, &a, %d, _cgo_ctxt);\n", cPrefix, exp.ExpName, off)