mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 04:59:38 +08:00

* Test release workflow * Update release.yml * Update release.yml * add linux deps * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Fix: Misc tests * Fix: Misc tests + linux build tags * Fix: Bindings tests + move templates to pkg. Add json schema for templates * Fix: template tests * Add tests to release workflow. Test for go 1.18 + go 1.19 Fix: ignore .m files for non darwin builds. Fix watcher test. Fix warning in clilogger. * Fix release pipeline * Matrix for tests * Rename templates to make tests work * Update template test * Debug template test * Debug template test * Debug template test * Fix gitignore * Update release.yml
36 lines
614 B
Go
36 lines
614 B
Go
//go:build linux
|
|
// +build linux
|
|
|
|
package linux
|
|
|
|
/*
|
|
#include <stdlib.h>
|
|
*/
|
|
import "C"
|
|
import "unsafe"
|
|
|
|
// Calloc handles alloc/dealloc of C data
|
|
type Calloc struct {
|
|
pool []unsafe.Pointer
|
|
}
|
|
|
|
// NewCalloc creates a new allocator
|
|
func NewCalloc() Calloc {
|
|
return Calloc{}
|
|
}
|
|
|
|
// String creates a new C string and retains a reference to it
|
|
func (c Calloc) String(in string) *C.char {
|
|
result := C.CString(in)
|
|
c.pool = append(c.pool, unsafe.Pointer(result))
|
|
return result
|
|
}
|
|
|
|
// Free frees all allocated C memory
|
|
func (c Calloc) Free() {
|
|
for _, str := range c.pool {
|
|
C.free(str)
|
|
}
|
|
c.pool = []unsafe.Pointer{}
|
|
}
|