mirror of
https://github.com/deuill/go-php.git
synced 2024-09-21 08:50:45 +00:00
Remove deprecated value
bindings.
This commit is contained in:
parent
403a114ef2
commit
44909ebb7f
5
value.c
5
value.c
@ -1,5 +0,0 @@
|
|||||||
#include "value.h"
|
|
||||||
|
|
||||||
void value_destroy(void *val) {
|
|
||||||
zval_dtor((zval *) val);
|
|
||||||
}
|
|
53
value.go
53
value.go
@ -1,53 +0,0 @@
|
|||||||
package php
|
|
||||||
|
|
||||||
// #include "value.h"
|
|
||||||
import "C"
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"reflect"
|
|
||||||
"runtime"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Value struct {
|
|
||||||
val unsafe.Pointer
|
|
||||||
kind reflect.Kind
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Value) Int() int64 {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Value) Float() float64 {
|
|
||||||
return 0.0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Value) Bool() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Value) String() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v *Value) Kind() reflect.Kind {
|
|
||||||
var k reflect.Kind = reflect.String
|
|
||||||
return k
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewValue(ptr unsafe.Pointer) (*Value, error) {
|
|
||||||
if ptr == nil {
|
|
||||||
return nil, fmt.Errorf("Attempted to initialize value with nil pointer")
|
|
||||||
}
|
|
||||||
|
|
||||||
val := &Value{
|
|
||||||
val: ptr,
|
|
||||||
}
|
|
||||||
|
|
||||||
runtime.SetFinalizer(val, func(v *Value) {
|
|
||||||
C.value_destroy(v.val)
|
|
||||||
})
|
|
||||||
|
|
||||||
return val, nil
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user