FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
array_destructstr.c
Go to the documentation of this file.
1
/* ERASE for dynamic arrays of var-len strings */
2
3
#include "
fb.h
"
4
5
void
fb_hArrayDtorStr
(
FBARRAY
*array,
FB_DEFCTOR
dtor,
size_t
base_idx )
6
{
7
ssize_t i, elements;
8
FBARRAYDIM
*dim;
9
FBSTRING
*this_;
10
11
if
( array->
ptr
==
NULL
)
12
return
;
13
14
dim = &array->
dimTB
[0];
15
elements = dim->elements - base_idx;
16
++dim;
17
18
for
( i = 1; i < array->
dimensions
; i++, dim++ )
19
elements *= dim->elements;
20
21
/* call dtors in the inverse order */
22
this_ = (
FBSTRING
*)array->
ptr
+ (base_idx + (elements-1));
23
24
while
( elements > 0 ) {
25
if
( this_->
data
!=
NULL
)
26
fb_StrDelete
( this_ );
27
--this_;
28
--elements;
29
}
30
}
31
32
FBCALL
void
fb_ArrayDestructStr
(
FBARRAY
*array )
33
{
34
fb_hArrayDtorStr
( array,
NULL
, 0 );
35
}
rtlib
array_destructstr.c
Generated on Thu Jan 23 2014 19:40:07 for FreeBASIC by
1.8.4