scrub memory>struct calls made redundant

Joe Groff 2010-02-22 12:22:29 -08:00
parent 4875169d0c
commit 47b4b10d03
9 changed files with 9 additions and 16 deletions

View File

@ -21,7 +21,7 @@ IN: calendar.unix
timespec>seconds since-1970 ;
: get-time ( -- alien )
f time <time_t> localtime tm memory>struct ;
f time <time_t> localtime ;
: timezone-name ( -- string )
get-time zone>> ;

View File

@ -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

View File

@ -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

View File

@ -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 ;

View File

@ -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 ;
: <group-cache> ( -- assoc )
all-groups [ [ id>> ] keep ] H{ } map>assoc ;

View File

@ -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

View File

@ -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 ]

View File

@ -49,8 +49,7 @@ unless
: (make-query-interface) ( interfaces -- quot )
(query-interface-cases)
'[
swap GUID memory>struct
_ case
swap _ case
[
void* heap-size * rot <displaced-alien> com-add-ref
swap 0 set-alien-cell S_OK

View File

@ -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 )