Refactor v7_to_number -> v7_get_double and others

We wanted to avoid `to` since it implies some kind of conversion, but
these functions merely return underlying C entity.

Public API changes:

- `v7_to_number()` -> `v7_get_double()`
- `v7_to_boolean()` -> `v7_get_bool()`
- `v7_to_cstring()` -> `v7_get_cstring()`
- `v7_get_string_data()` -> `v7_get_string()`
- `v7_to_foreign()` -> `v7_get_ptr()`

Private API changes:

- `v7_to_pointer()` -> `get_ptr()`
- `v7_to_generic_object()` -> `get_generic_object_struct()`
- `v7_to_object()` -> `get_object_struct()`
- `to_js_function()` -> `get_js_function_struct()`
- `to_cfunction()` -> `get_cfunction_ptr()`

PUBLISHED_FROM=036ac18d442c1128106292ad3e7a818b177eec6a
This commit is contained in:
Dmitry Frank 2016-05-13 16:18:01 +02:00 committed by rojer
parent 23122b327c
commit d4b81bb911

View File

@ -2269,11 +2269,11 @@ void mg_mgr_init(struct mg_mgr *m, void *user_data) {
static enum v7_err mg_send_js(struct v7 *v7, v7_val_t *res) {
v7_val_t arg0 = v7_arg(v7, 0);
v7_val_t arg1 = v7_arg(v7, 1);
struct mg_connection *c = (struct mg_connection *) v7_to_foreign(arg0);
struct mg_connection *c = (struct mg_connection *) v7_get_ptr(arg0);
size_t len = 0;
if (v7_is_string(arg1)) {
const char *data = v7_get_string_data(v7, &arg1, &len);
const char *data = v7_get_string(v7, &arg1, &len);
mg_send(c, data, len);
}