forked from ImortisInglorian/fbrtLib
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharray_destructstr.bas
More file actions
40 lines (32 loc) · 845 Bytes
/
Copy patharray_destructstr.bas
File metadata and controls
40 lines (32 loc) · 845 Bytes
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
37
38
39
40
/' ERASE for dynamic arrays of var-len strings '/
#include "fb.bi"
extern "C"
sub fb_hArrayDtorStr cdecl ( array as FBARRAY ptr, dtor as FB_DEFCTOR, base_idx as size_t )
dim as size_t i
dim as ssize_t elements
dim as FBARRAYDIM ptr _dim
dim as FBSTRING ptr this_
if ( array->_ptr = NULL ) then
exit sub
end if
_dim = @array->dimTB(0)
elements = _dim->elements - base_idx
_dim += 1
for i = 1 to array->dimensions
elements *= _dim->elements
_dim += 1
next
/' call dtors in the inverse order '/
this_ = cast(FBSTRING ptr, array->_ptr + (base_idx + (elements-1)))
while( elements > 0 )
if ( this_->data <> NULL ) then
fb_StrDelete( this_ )
end if
this_ -= 1
elements -= 1
wend
end sub
sub fb_ArrayDestructStr FBCALL ( array as FBARRAY ptr )
fb_hArrayDtorStr( array, NULL, 0 )
end sub
end extern