-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy patharray_clear.bas
36 lines (27 loc) · 1.01 KB
/
array_clear.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/' ERASE for static arrays: clear the elements
fb_ArrayClear() is called directly if it is known at
compile time that the array is static (fixed length)
fb_ArrayClear() is called indirectly through fb_ArrayClearObj()
after the array elements have been destructed
fb_ArrayDestructStr() clears the array so there is
no need to call fb_ArrayClear() also
for plain arrays: fbc calls fb_ArrayClear()
for object arrays: fbc calls fb_ArrayClearObj()
for FBSTRING arrays: fbc calls fb_ArrayDestructStr()
...for STRING*N arrays: fbc calls fb_ArrayFill()
'/
#include "fb.bi"
extern "C"
function fb_ArrayClear FBCALL ( array as FBARRAY ptr ) as long
if ( array->_ptr ) then
memset( array->_ptr, 0, array->size )
end if
return fb_ErrorSetNum( FB_RTERROR_OK )
end function
function fb_ArrayFill FBCALL ( array as FBARRAY ptr, byval fillchar as long ) as long
if ( array->_ptr ) then
memset( array->_ptr, fillchar, array->size )
end if
return fb_ErrorSetNum( FB_RTERROR_OK )
end function
end extern