<commit_before>extern crate libnotify_sys as libnotify;
extern crate glib_2_0_sys as glib;

fn main() {
    unsafe {
        use libnotify::*;
        use std::mem::transmute as tm;

        if notify_init(tm("hello\0".as_ptr())) == 0 {
            panic!("Failed to init libnotify");
        }

        let notif = notify_notification_new(tm("Hello\0".as_ptr()),
                                            tm("World\0".as_ptr()),
                                            0 as *const i8);
        let mut error = 0 as *mut glib::GError;
        notify_notification_show(notif, &mut error);
        if error != 0 as *mut glib::GError {
            glib::g_error_free(error);
        }

        notify_uninit();
    }
}<commit_msg>Make example more idiomatic<commit_after>extern crate libnotify_sys as libnotify;
extern crate glib_2_0_sys as glib;

fn main() {
    unsafe {
        use libnotify::*;
        use std::os::raw::c_char;
        use std::ptr;

        if notify_init("hello\0".as_ptr() as *const c_char) == 0 {
            panic!("Failed to init libnotify");
        }

        let notif = notify_notification_new("Hello\0".as_ptr() as *const c_char,
                                            "World\0".as_ptr() as *const c_char,
                                            ptr::null());
        let mut error = ptr::null_mut();
        notify_notification_show(notif, &mut error);

        if error != ptr::null_mut() {
            glib::g_error_free(error);
        }

        notify_uninit();
    }
}
{'fraction_non_alphanumeric': 0.12039473684210526, 'fraction_numerical': 0.010526315789473684, 'mean_word_length': 1.7209302325581395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '299745', 'n_tokens_mistral': 457, 'n_tokens_neox': 442, 'n_words': 107}