Skip to content

Commit

Permalink
Remove _db suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Aug 28, 2023
1 parent f0cc40f commit 3d24aa0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 44 deletions.
32 changes: 16 additions & 16 deletions internal/api/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,22 @@ typedef struct iterator_t {
} iterator_t;

typedef struct Iterator_vtable {
int32_t (*next_db)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next_key_db)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next_value_db)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next_key)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next_value)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*);
} Iterator_vtable;

typedef struct GoIter {
Expand Down
6 changes: 3 additions & 3 deletions internal/api/callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ func buildDB(state *DBState, gm *types.GasMeter) C.Db {
}

var iterator_vtable = C.Iterator_vtable{
next_db: (C.next_db_fn)(C.cNext_cgo),
next_key_db: (C.next_key_db_fn)(C.cNextKey_cgo),
next_value_db: (C.next_value_db_fn)(C.cNextValue_cgo),
next: (C.next_db_fn)(C.cNext_cgo),
next_key: (C.next_key_db_fn)(C.cNextKey_cgo),
next_value: (C.next_value_db_fn)(C.cNextValue_cgo),
}

// An iterator including referenced objects is 117 bytes large (calculated using https://github.com/DmitriyVTitov/size).
Expand Down
32 changes: 16 additions & 16 deletions libwasmvm/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,22 @@ typedef struct iterator_t {
} iterator_t;

typedef struct Iterator_vtable {
int32_t (*next_db)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next_key_db)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next_value_db)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next_key)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*);
int32_t (*next_value)(struct iterator_t,
struct gas_meter_t*,
uint64_t*,
struct UnmanagedVector*,
struct UnmanagedVector*);
} Iterator_vtable;

typedef struct GoIter {
Expand Down
18 changes: 9 additions & 9 deletions libwasmvm/src/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct iterator_t {
#[repr(C)]
#[derive(Default)]
pub struct Iterator_vtable {
pub next_db: Option<
pub next: Option<
extern "C" fn(
iterator_t,
*mut gas_meter_t,
Expand All @@ -29,7 +29,7 @@ pub struct Iterator_vtable {
*mut UnmanagedVector, // error message output
) -> i32,
>,
pub next_key_db: Option<
pub next_key: Option<
extern "C" fn(
iterator_t,
*mut gas_meter_t,
Expand All @@ -38,7 +38,7 @@ pub struct Iterator_vtable {
*mut UnmanagedVector, // error message output
) -> i32,
>,
pub next_value_db: Option<
pub next_value: Option<
extern "C" fn(
iterator_t,
*mut gas_meter_t,
Expand Down Expand Up @@ -66,7 +66,7 @@ impl GoIter {
}

pub fn next(&mut self) -> BackendResult<Option<Record>> {
let next_db = match self.vtable.next_db {
let next = match self.vtable.next {
Some(f) => f,
None => {
let result = Err(BackendError::unknown("iterator vtable not set"));
Expand All @@ -78,7 +78,7 @@ impl GoIter {
let mut output_value = UnmanagedVector::default();
let mut error_msg = UnmanagedVector::default();
let mut used_gas = 0_u64;
let go_result: GoError = (next_db)(
let go_result: GoError = (next)(
self.state,
self.gas_meter,
&mut used_gas as *mut u64,
Expand Down Expand Up @@ -117,11 +117,11 @@ impl GoIter {
}

pub fn next_key(&mut self) -> BackendResult<Option<Vec<u8>>> {
self.next_key_or_val(self.vtable.next_key_db)
self.next_key_or_val(self.vtable.next_key)
}

pub fn next_value(&mut self) -> BackendResult<Option<Vec<u8>>> {
self.next_key_or_val(self.vtable.next_value_db)
self.next_key_or_val(self.vtable.next_value)
}

#[inline(always)]
Expand All @@ -137,7 +137,7 @@ impl GoIter {
) -> i32,
>,
) -> BackendResult<Option<Vec<u8>>> {
let next_db = match next_fn {
let next = match next_fn {
Some(f) => f,
None => {
let result = Err(BackendError::unknown("iterator vtable not set"));
Expand All @@ -148,7 +148,7 @@ impl GoIter {
let mut output = UnmanagedVector::default();
let mut error_msg = UnmanagedVector::default();
let mut used_gas = 0_u64;
let go_result: GoError = (next_db)(
let go_result: GoError = (next)(
self.state,
self.gas_meter,
&mut used_gas as *mut u64,
Expand Down

0 comments on commit 3d24aa0

Please sign in to comment.