Sha256: 6490169aab578c43ca088333753c8b9cad1bd8106dc9382fd9a51143540a41e2

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

use libc::c_char;
use std::ffi::{CStr};
use std::str;

#[no_mangle]
pub extern fn both_are_blank(s1: *const c_char, s2: *const c_char) -> bool {
  let c_str1 = unsafe {
    assert!(!s1.is_null());
    CStr::from_ptr(s1)
  };
  let c_str2 = unsafe {
    assert!(!s2.is_null());
    CStr::from_ptr(s2)
  };

  str::from_utf8(c_str1.to_bytes()).unwrap().trim().is_empty() &&
    str::from_utf8(c_str2.to_bytes()).unwrap().trim().is_empty()
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
faster_path-0.1.7 src/both_are_blank.rs
faster_path-0.1.6 src/both_are_blank.rs