Rename the refnum field, Num, to something much less likely to clash with an interface method set. Change-Id: If334966b2430f38118baded44461bd39298bafb0 Reviewed-on: https://go-review.googlesource.com/20983 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
37 lines
744 B
Plaintext
37 lines
744 B
Plaintext
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package gomobile_bind
|
|
|
|
// Go support functions for generated Go bindings. This file is
|
|
// copied into the generated package, gomobile_bind, and compiled
|
|
// along with the bindings.
|
|
|
|
// #include <stdlib.h>
|
|
// #include "seq.h"
|
|
import "C"
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
_seq "golang.org/x/mobile/bind/seq"
|
|
)
|
|
|
|
func toError(s string) error {
|
|
if s == "" {
|
|
return nil
|
|
}
|
|
return errors.New(s)
|
|
}
|
|
|
|
func init() {
|
|
_seq.FinalizeRef = func(ref *_seq.Ref) {
|
|
if ref.Bind_Num < 0 {
|
|
panic(fmt.Sprintf("not a foreign ref: %d", ref.Bind_Num))
|
|
}
|
|
C.go_seq_dec_ref(C.int32_t(ref.Bind_Num))
|
|
}
|
|
}
|