Skip to content

Commit

Permalink
inline
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Jun 19, 2024
1 parent a59f3eb commit b379b7f
Show file tree
Hide file tree
Showing 56 changed files with 126 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/libs/bindgen/src/rust/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub fn gen_win_handle(writer: &Writer, def: metadata::TypeDef) -> TokenStream {

quote! {
impl windows_core::Free for #ident {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
#result #name(*self #tail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ impl ORHKEY {
}
}
impl windows_core::Free for ORHKEY {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = ORCloseKey(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,7 @@ impl HBLUETOOTH_DEVICE_FIND {
}
}
impl windows_core::Free for HBLUETOOTH_DEVICE_FIND {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = BluetoothFindDeviceClose(*self);
Expand All @@ -2056,6 +2057,7 @@ impl HBLUETOOTH_RADIO_FIND {
}
}
impl windows_core::Free for HBLUETOOTH_RADIO_FIND {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = BluetoothFindRadioClose(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8071,6 +8071,7 @@ impl HCMNOTIFICATION {
}
}
impl windows_core::Free for HCMNOTIFICATION {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = CM_Unregister_Notification(*self);
Expand All @@ -8094,6 +8095,7 @@ impl HDEVINFO {
}
}
impl windows_core::Free for HDEVINFO {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = SetupDiDestroyDeviceInfoList(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4430,6 +4430,7 @@ impl HSEMAPHORE {
}
}
impl windows_core::Free for HSEMAPHORE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
EngDeleteSemaphore(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,7 @@ impl HSWDEVICE {
}
}
impl windows_core::Free for HSWDEVICE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
SwDeviceClose(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ impl HCOMDB {
}
}
impl windows_core::Free for HCOMDB {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = ComDBClose(*self);
Expand Down
1 change: 1 addition & 0 deletions crates/libs/windows/src/Windows/Win32/Devices/Usb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4556,6 +4556,7 @@ impl WINUSB_INTERFACE_HANDLE {
}
}
impl windows_core::Free for WINUSB_INTERFACE_HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = WinUsb_Free(*self);
Expand Down
5 changes: 5 additions & 0 deletions crates/libs/windows/src/Windows/Win32/Foundation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10647,6 +10647,7 @@ impl HANDLE {
}
}
impl windows_core::Free for HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = CloseHandle(*self);
Expand Down Expand Up @@ -10681,6 +10682,7 @@ impl HGLOBAL {
}
}
impl windows_core::Free for HGLOBAL {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = GlobalFree(*self);
Expand All @@ -10704,6 +10706,7 @@ impl HINSTANCE {
}
}
impl windows_core::Free for HINSTANCE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = FreeLibrary(*self);
Expand Down Expand Up @@ -10733,6 +10736,7 @@ impl HLOCAL {
}
}
impl windows_core::Free for HLOCAL {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = LocalFree(*self);
Expand Down Expand Up @@ -10772,6 +10776,7 @@ impl HMODULE {
}
}
impl windows_core::Free for HMODULE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = FreeLibrary(*self);
Expand Down
9 changes: 9 additions & 0 deletions crates/libs/windows/src/Windows/Win32/Graphics/Gdi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8536,6 +8536,7 @@ impl HBITMAP {
}
}
impl windows_core::Free for HBITMAP {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteObject(*self);
Expand Down Expand Up @@ -8565,6 +8566,7 @@ impl HBRUSH {
}
}
impl windows_core::Free for HBRUSH {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteObject(*self);
Expand Down Expand Up @@ -8610,6 +8612,7 @@ impl HENHMETAFILE {
}
}
impl windows_core::Free for HENHMETAFILE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteEnhMetaFile(*self);
Expand All @@ -8633,6 +8636,7 @@ impl HFONT {
}
}
impl windows_core::Free for HFONT {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteObject(*self);
Expand Down Expand Up @@ -8662,6 +8666,7 @@ impl HGDIOBJ {
}
}
impl windows_core::Free for HGDIOBJ {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteObject(*self);
Expand All @@ -8685,6 +8690,7 @@ impl HMETAFILE {
}
}
impl windows_core::Free for HMETAFILE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteMetaFile(*self);
Expand Down Expand Up @@ -8724,6 +8730,7 @@ impl HPALETTE {
}
}
impl windows_core::Free for HPALETTE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteObject(*self);
Expand Down Expand Up @@ -8753,6 +8760,7 @@ impl HPEN {
}
}
impl windows_core::Free for HPEN {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteObject(*self);
Expand Down Expand Up @@ -8782,6 +8790,7 @@ impl HRGN {
}
}
impl windows_core::Free for HRGN {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = DeleteObject(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,7 @@ impl HGLRC {
}
}
impl windows_core::Free for HGLRC {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = wglDeleteContext(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl HPTPROVIDER {
}
}
impl windows_core::Free for HPTPROVIDER {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = PTCloseProvider(*self);
Expand Down
8 changes: 8 additions & 0 deletions crates/libs/windows/src/Windows/Win32/Media/Audio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5450,6 +5450,7 @@ impl HACMDRIVER {
}
}
impl windows_core::Free for HACMDRIVER {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = acmDriverClose(*self, 0);
Expand Down Expand Up @@ -5505,6 +5506,7 @@ impl HACMSTREAM {
}
}
impl windows_core::Free for HACMSTREAM {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = acmStreamClose(*self, 0);
Expand Down Expand Up @@ -5544,6 +5546,7 @@ impl HMIDIIN {
}
}
impl windows_core::Free for HMIDIIN {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = midiInClose(*self);
Expand All @@ -5567,6 +5570,7 @@ impl HMIDIOUT {
}
}
impl windows_core::Free for HMIDIOUT {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = midiOutClose(*self);
Expand All @@ -5590,6 +5594,7 @@ impl HMIDISTRM {
}
}
impl windows_core::Free for HMIDISTRM {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = midiStreamClose(*self);
Expand All @@ -5613,6 +5618,7 @@ impl HMIXER {
}
}
impl windows_core::Free for HMIXER {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = mixerClose(*self);
Expand Down Expand Up @@ -5668,6 +5674,7 @@ impl HWAVEIN {
}
}
impl windows_core::Free for HWAVEIN {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = waveInClose(*self);
Expand All @@ -5691,6 +5698,7 @@ impl HWAVEOUT {
}
}
impl windows_core::Free for HWAVEOUT {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = waveOutClose(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6919,6 +6919,7 @@ impl HIC {
}
}
impl windows_core::Free for HIC {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = ICClose(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,7 @@ impl HIFTIMESTAMPCHANGE {
}
}
impl windows_core::Free for HIFTIMESTAMPCHANGE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
UnregisterInterfaceTimestampConfigChange(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ impl WEB_SOCKET_HANDLE {
}
}
impl windows_core::Free for WEB_SOCKET_HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
WebSocketDeleteHandle(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7692,6 +7692,7 @@ impl SOCKET {
}
}
impl windows_core::Free for SOCKET {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = closesocket(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6266,6 +6266,7 @@ impl LSA_HANDLE {
}
}
impl windows_core::Free for LSA_HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = LsaClose(*self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5141,6 +5141,7 @@ impl AUTHZ_ACCESS_CHECK_RESULTS_HANDLE {
}
}
impl windows_core::Free for AUTHZ_ACCESS_CHECK_RESULTS_HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = AuthzFreeHandle(*self);
Expand Down Expand Up @@ -5197,6 +5198,7 @@ impl AUTHZ_AUDIT_EVENT_HANDLE {
}
}
impl windows_core::Free for AUTHZ_AUDIT_EVENT_HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = AuthzFreeAuditEvent(*self);
Expand Down Expand Up @@ -5282,6 +5284,7 @@ impl AUTHZ_CAP_CHANGE_SUBSCRIPTION_HANDLE {
}
}
impl windows_core::Free for AUTHZ_CAP_CHANGE_SUBSCRIPTION_HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = AuthzUnregisterCapChangeNotification(*self);
Expand All @@ -5305,6 +5308,7 @@ impl AUTHZ_CLIENT_CONTEXT_HANDLE {
}
}
impl windows_core::Free for AUTHZ_CLIENT_CONTEXT_HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = AuthzFreeContext(*self);
Expand Down Expand Up @@ -5361,6 +5365,7 @@ impl AUTHZ_RESOURCE_MANAGER_HANDLE {
}
}
impl windows_core::Free for AUTHZ_RESOURCE_MANAGER_HANDLE {
#[inline]
unsafe fn free(&mut self) {
if !self.is_invalid() {
_ = AuthzFreeResourceManager(*self);
Expand Down
Loading

0 comments on commit b379b7f

Please sign in to comment.