diff --git a/value.c b/value.c index 736e84d..5f912bf 100644 --- a/value.c +++ b/value.c @@ -5,7 +5,7 @@ #include "engine.h" #include "value.h" -void *value_long(long int value) { +void *value_create_long(long int value) { zval *v; MAKE_STD_ZVAL(v); @@ -14,7 +14,7 @@ void *value_long(long int value) { return_multi((void *) v, 0); } -void *value_double(double value) { +void *value_create_double(double value) { zval *v; MAKE_STD_ZVAL(v); @@ -23,7 +23,7 @@ void *value_double(double value) { return_multi((void *) v, 0); } -void *value_bool(bool value) { +void *value_create_bool(bool value) { zval *v; MAKE_STD_ZVAL(v); @@ -32,7 +32,7 @@ void *value_bool(bool value) { return_multi((void *) v, 0); } -void *value_string(char *value) { +void *value_create_string(char *value) { zval *v; MAKE_STD_ZVAL(v); diff --git a/value.go b/value.go index d67515f..bf92f48 100644 --- a/value.go +++ b/value.go @@ -27,18 +27,19 @@ func NewValue(v interface{}) (*Value, error) { var ptr unsafe.Pointer var err error + // Determine value type and create PHP value from the concrete type. switch v := v.(type) { case int: - ptr, err = C.value_long(C.long(v)) + ptr, err = C.value_create_long(C.long(v)) case float64: - ptr, err = C.value_double(C.double(v)) + ptr, err = C.value_create_double(C.double(v)) case bool: - ptr, err = C.value_bool(C.bool(v)) + ptr, err = C.value_create_bool(C.bool(v)) case string: str := C.CString(v) defer C.free(unsafe.Pointer(str)) - ptr, err = C.value_string(str) + ptr, err = C.value_create_string(str) default: return nil, fmt.Errorf("Cannot create value of unknown type '%T'", v) } diff --git a/value.h b/value.h index 93ecf1b..5bbf806 100644 --- a/value.h +++ b/value.h @@ -1,10 +1,10 @@ #ifndef VALUE_H #define VALUE_H -void *value_long(long int value); -void *value_double(double value); -void *value_bool(bool value); -void *value_string(char *value); +void *value_create_long(long int value); +void *value_create_double(double value); +void *value_create_bool(bool value); +void *value_create_string(char *value); void value_destroy(void *zvalptr); #endif \ No newline at end of file