From: Joe Groff Date: Mon, 22 Feb 2010 20:22:29 +0000 (-0800) Subject: scrub memory>struct calls made redundant X-Git-Tag: 0.97~4841^2~8 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=6d4724a095fc81b30fdb3661d9fd24b07058df01 scrub memory>struct calls made redundant --- diff --git a/basis/calendar/unix/unix.factor b/basis/calendar/unix/unix.factor index ac72385d8c..fdc85c943a 100644 --- a/basis/calendar/unix/unix.factor +++ b/basis/calendar/unix/unix.factor @@ -21,7 +21,7 @@ IN: calendar.unix timespec>seconds since-1970 ; : get-time ( -- alien ) - f time localtime tm memory>struct ; + f time localtime ; : timezone-name ( -- string ) get-time zone>> ; diff --git a/basis/game/input/dinput/dinput.factor b/basis/game/input/dinput/dinput.factor index e2c1fda759..a95dbd06c3 100755 --- a/basis/game/input/dinput/dinput.factor +++ b/basis/game/input/dinput/dinput.factor @@ -94,7 +94,6 @@ SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+ : find-device-axes-callback ( -- alien ) [ ! ( lpddoi pvRef -- BOOL ) - [ DIDEVICEOBJECTINSTANCEW memory>struct ] dip +controller-devices+ get at swap guidType>> { { [ dup GUID_XAxis = ] [ drop 0.0 >>x ] } @@ -142,7 +141,7 @@ SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+ : find-controller-callback ( -- alien ) [ ! ( lpddi pvRef -- BOOL ) - drop DIDEVICEINSTANCEW memory>struct guidInstance>> add-controller + drop guidInstance>> add-controller DIENUM_CONTINUE ] LPDIENUMDEVICESCALLBACKW ; inline diff --git a/basis/specialized-arrays/specialized-arrays.factor b/basis/specialized-arrays/specialized-arrays.factor index 97ce2ed1ff..2aca62cc77 100644 --- a/basis/specialized-arrays/specialized-arrays.factor +++ b/basis/specialized-arrays/specialized-arrays.factor @@ -143,9 +143,6 @@ PRIVATE> [ specialized-array-vocab ] [ '[ _ define-array ] ] bi generate-vocab ; -M: c-type-word require-c-array define-array-vocab drop ; -M: pointer require-c-array drop void* require-c-array ; - ERROR: specialized-array-vocab-not-loaded c-type ; M: c-type-word c-array-constructor diff --git a/basis/ui/backend/x11/x11.factor b/basis/ui/backend/x11/x11.factor index 673dd8e9c3..74d911ef90 100644 --- a/basis/ui/backend/x11/x11.factor +++ b/basis/ui/backend/x11/x11.factor @@ -49,8 +49,7 @@ PIXEL-FORMAT-ATTRIBUTE-TABLE: glx-visual { $ GLX_USE_GL $ GLX_RGBA } H{ M: x11-ui-backend (make-pixel-format) [ drop dpy get scr get ] dip - >glx-visual-int-array glXChooseVisual - XVisualInfo memory>struct ; + >glx-visual-int-array glXChooseVisual ; M: x11-ui-backend (free-pixel-format) handle>> XFree ; diff --git a/basis/unix/groups/groups.factor b/basis/unix/groups/groups.factor index b009fe529f..7be124ced4 100644 --- a/basis/unix/groups/groups.factor +++ b/basis/unix/groups/groups.factor @@ -83,7 +83,7 @@ M: integer user-groups ( id -- seq ) user-name (user-groups) ; : all-groups ( -- seq ) - [ unix.ffi:getgrent dup ] [ \ unix.ffi:group memory>struct group-struct>group ] produce nip ; + [ unix.ffi:getgrent dup ] [ group-struct>group ] produce nip ; : ( -- assoc ) all-groups [ [ id>> ] keep ] H{ } map>assoc ; diff --git a/basis/unix/users/users.factor b/basis/unix/users/users.factor index 5de176e242..0575538b87 100644 --- a/basis/unix/users/users.factor +++ b/basis/unix/users/users.factor @@ -37,7 +37,7 @@ PRIVATE> : all-users ( -- seq ) [ - [ unix.ffi:getpwent dup ] [ unix.ffi:passwd memory>struct passwd>new-passwd ] produce nip + [ unix.ffi:getpwent dup ] [ passwd>new-passwd ] produce nip ] with-pwent ; SYMBOL: user-cache @@ -52,10 +52,10 @@ GENERIC: user-passwd ( obj -- passwd/f ) M: integer user-passwd ( id -- passwd/f ) user-cache get - [ at ] [ unix.ffi:getpwuid [ unix.ffi:passwd memory>struct passwd>new-passwd ] [ f ] if* ] if* ; + [ at ] [ unix.ffi:getpwuid [ passwd>new-passwd ] [ f ] if* ] if* ; M: string user-passwd ( string -- passwd/f ) - unix.ffi:getpwnam dup [ unix.ffi:passwd memory>struct passwd>new-passwd ] when ; + unix.ffi:getpwnam dup [ passwd>new-passwd ] when ; : user-name ( id -- string ) dup user-passwd diff --git a/basis/unix/utmpx/utmpx.factor b/basis/unix/utmpx/utmpx.factor index 78556ab225..1d6dfdedec 100644 --- a/basis/unix/utmpx/utmpx.factor +++ b/basis/unix/utmpx/utmpx.factor @@ -41,7 +41,7 @@ M: unix new-utmpx-record utmpx-record new ; M: unix utmpx>utmpx-record ( utmpx -- utmpx-record ) - [ new-utmpx-record ] dip \ utmpx memory>struct + [ new-utmpx-record ] dip { [ ut_user>> _UTX_USERSIZE memory>string >>user ] [ ut_id>> _UTX_IDSIZE memory>string >>id ] diff --git a/basis/windows/com/wrapper/wrapper.factor b/basis/windows/com/wrapper/wrapper.factor index 696902439c..623a9c8db3 100644 --- a/basis/windows/com/wrapper/wrapper.factor +++ b/basis/windows/com/wrapper/wrapper.factor @@ -49,8 +49,7 @@ unless : (make-query-interface) ( interfaces -- quot ) (query-interface-cases) '[ - swap GUID memory>struct - _ case + swap _ case [ void* heap-size * rot com-add-ref swap 0 set-alien-cell S_OK diff --git a/basis/windows/uniscribe/uniscribe.factor b/basis/windows/uniscribe/uniscribe.factor index 87540dc24f..2783840df0 100644 --- a/basis/windows/uniscribe/uniscribe.factor +++ b/basis/windows/uniscribe/uniscribe.factor @@ -82,7 +82,6 @@ TUPLE: script-string < disposable font string metrics ssa size image ; : script-string-size ( script-string -- dim ) ssa>> ScriptString_pSize dup win32-error=0/f - SIZE memory>struct [ cx>> ] [ cy>> ] bi 2array ; : dc-metrics ( dc -- metrics )