Skip to content

Instantly share code, notes, and snippets.

on_error:
if (why == WHY_NOT) {
if (err == 0 && x != NULL) {
continue; /* Normal, fast path */
}
why = WHY_EXCEPTION;
x = Py_None;
err = 0;
}
/* Double-check exception status */
extern crate libc;
use libc::size_t;
#[link(name = "snappy")]
extern {
fn snappy_max_compressed_length(source_length: size_t) -> size_t;
}
fn main() {
let x = unsafe { snappy_max_compressed_length(100) };