Skip to content

Commit

Permalink
WIP: Don't derive Copy for FFI structs with pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
sdroege committed Feb 4, 2021
1 parent 9fa43c1 commit b3b2cba
Show file tree
Hide file tree
Showing 77 changed files with 476 additions and 451 deletions.
1 change: 0 additions & 1 deletion atk/src/auto/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::translate::*;
use std::fmt;

glib::wrapper! {
Expand Down
2 changes: 1 addition & 1 deletion atk/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 21213ed)
Generated by gir (https://github.com/gtk-rs/gir @ cbdc2e47c+)
from gir-files (https://github.com/gtk-rs/gir-files @ 21f7670)
18 changes: 9 additions & 9 deletions atk/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl ::std::fmt::Debug for AtkActionIface {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkAttribute {
pub name: *mut c_char,
pub value: *mut c_char,
Expand Down Expand Up @@ -652,7 +652,7 @@ pub struct _AtkImplementor(c_void);
pub type AtkImplementor = *mut _AtkImplementor;

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkKeyEventStruct {
pub type_: c_int,
pub state: c_uint,
Expand Down Expand Up @@ -844,7 +844,7 @@ impl ::std::fmt::Debug for AtkPlugClass {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkPropertyValues {
pub property_name: *const c_char,
pub old_value: gobject::GValue,
Expand Down Expand Up @@ -1282,7 +1282,7 @@ impl ::std::fmt::Debug for AtkTextIface {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkTextRange {
pub bounds: AtkTextRectangle,
pub start_offset: c_int,
Expand Down Expand Up @@ -1475,7 +1475,7 @@ impl ::std::fmt::Debug for AtkNoOpObjectFactory {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkObject {
pub parent: gobject::GObject,
pub description: *mut c_char,
Expand Down Expand Up @@ -1529,7 +1529,7 @@ impl ::std::fmt::Debug for AtkPlug {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkRegistry {
pub parent: gobject::GObject,
pub factory_type_registry: *mut glib::GHashTable,
Expand All @@ -1547,7 +1547,7 @@ impl ::std::fmt::Debug for AtkRegistry {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkRelation {
pub parent: gobject::GObject,
pub target: *mut glib::GPtrArray,
Expand All @@ -1565,7 +1565,7 @@ impl ::std::fmt::Debug for AtkRelation {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkRelationSet {
pub parent: gobject::GObject,
pub relations: *mut glib::GPtrArray,
Expand All @@ -1581,7 +1581,7 @@ impl ::std::fmt::Debug for AtkRelationSet {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct AtkSocket {
pub parent: AtkObject,
pub embedded_plug_id: *mut c_char,
Expand Down
4 changes: 3 additions & 1 deletion atk/sys/tests/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use atk_sys::*;
use std::env;
use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
Expand Down Expand Up @@ -69,7 +70,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
Expand Down
2 changes: 1 addition & 1 deletion atk/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 21213ed)
Generated by gir (https://github.com/gtk-rs/gir @ cbdc2e47c+)
from gir-files (https://github.com/gtk-rs/gir-files @ 21f7670)
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/pixbuf_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ glib::wrapper! {
pub struct PixbufFormat(Boxed<ffi::GdkPixbufFormat>);

match fn {
copy => |ptr| ffi::gdk_pixbuf_format_copy(mut_override(ptr)),
copy => |ptr| ffi::gdk_pixbuf_format_copy(ptr),
free => |ptr| ffi::gdk_pixbuf_format_free(ptr),
get_type => || ffi::gdk_pixbuf_format_get_type(),
}
Expand Down
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 21213ed)
Generated by gir (https://github.com/gtk-rs/gir @ cbdc2e47c+)
from gir-files (https://github.com/gtk-rs/gir-files @ 21f7670)
6 changes: 3 additions & 3 deletions gdk-pixbuf/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl ::std::fmt::Debug for GdkPixbufAnimationIterClass {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct GdkPixbufFormat {
pub name: *mut c_char,
pub signature: *mut GdkPixbufModulePattern,
Expand Down Expand Up @@ -185,7 +185,7 @@ impl ::std::fmt::Debug for GdkPixbufLoaderClass {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct GdkPixbufModule {
pub module_name: *mut c_char,
pub module_path: *mut c_char,
Expand Down Expand Up @@ -259,7 +259,7 @@ impl ::std::fmt::Debug for GdkPixbufModule {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Clone)]
pub struct GdkPixbufModulePattern {
pub prefix: *mut c_char,
pub mask: *mut c_char,
Expand Down
4 changes: 3 additions & 1 deletion gdk-pixbuf/sys/tests/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use gdk_pixbuf_sys::*;
use std::env;
use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
Expand Down Expand Up @@ -69,7 +70,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
Expand Down
2 changes: 1 addition & 1 deletion gdk-pixbuf/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 21213ed)
Generated by gir (https://github.com/gtk-rs/gir @ cbdc2e47c+)
from gir-files (https://github.com/gtk-rs/gir-files @ 21f7670)
2 changes: 2 additions & 0 deletions gdk/src/auto/device_pad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use crate::Device;
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))]
use crate::DevicePadFeature;
use glib::object::IsA;
#[cfg(any(feature = "v3_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))]
use glib::translate::*;
use std::fmt;

Expand Down
2 changes: 2 additions & 0 deletions gdk/src/auto/drawing_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#[cfg(any(feature = "v3_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))]
use crate::Window;
#[cfg(any(feature = "v3_22", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))]
use glib::translate::*;
use std::fmt;

Expand Down
4 changes: 4 additions & 0 deletions gdk/src/auto/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

#[cfg(any(feature = "v3_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_16")))]
use glib::error::ErrorDomain;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
#[cfg(any(feature = "v3_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_16")))]
use glib::Quark;
use glib::StaticType;
use glib::Type;
Expand Down
2 changes: 2 additions & 0 deletions gdk/src/auto/gl_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use crate::Display;
#[cfg(any(feature = "v3_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_16")))]
use crate::Window;
#[cfg(any(feature = "v3_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_16")))]
use glib::translate::*;
use std::fmt;
#[cfg(any(feature = "v3_16", feature = "dox"))]
Expand Down
2 changes: 2 additions & 0 deletions gdk/src/auto/seat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ use glib::signal::connect_raw;
#[cfg(any(feature = "v3_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
use glib::signal::SignalHandlerId;
#[cfg(any(feature = "v3_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
use glib::translate::*;
#[cfg(any(feature = "v3_20", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
Expand Down
2 changes: 1 addition & 1 deletion gdk/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 21213ed)
Generated by gir (https://github.com/gtk-rs/gir @ cbdc2e47c+)
from gir-files (https://github.com/gtk-rs/gir-files @ 21f7670)
Loading

0 comments on commit b3b2cba

Please sign in to comment.