Skip to content

Commit

Permalink
clean up ffi from pyframe to pyhash
Browse files Browse the repository at this point in the history
  • Loading branch information
deantvv committed Aug 7, 2021
1 parent 9a73569 commit ea40cac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/ffi/pyframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ opaque_struct!(PyFrameObject);
extern "C" {
pub fn PyFrame_GetLineNumber(f: *mut PyFrameObject) -> c_int;
}
// skipped PyFrame_GetLineNumber
// skipped PyFrame_GetCode
22 changes: 21 additions & 1 deletion src/ffi/pyhash.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
use crate::ffi::pyport::{Py_hash_t, Py_ssize_t};
use std::os::raw::{c_char, c_int, c_void};
use std::os::raw::{c_char, c_int, c_ulong, c_void};

// skipped non-limited _Py_HashDouble
// skipped non-limited _Py_HashPointer
// skipped non-limited _Py_HashPointerRaw
// skipped non-limited _Py_HashBytes

pub const _PyHASH_MULTIPLIER: c_ulong = 1000003;

// skipped _PyHASH_BITS

// skipped non-limited _Py_HashSecret_t

#[cfg(not(Py_LIMITED_API))]
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PyHash_FuncDef {
Expand All @@ -22,3 +34,11 @@ extern "C" {
#[cfg(not(PyPy))]
pub fn _Py_HashBytes(src: *const c_void, len: Py_ssize_t) -> Py_hash_t;
}

// skipped Py_HASH_CUTOFF

pub const Py_HASH_EXTERNAL: c_int = 0;
pub const Py_HASH_SIPHASH24: c_int = 1;
pub const Py_HASH_FNV: c_int = 2;

// skipped Py_HASH_ALGORITHM

0 comments on commit ea40cac

Please sign in to comment.