FreeBASIC  0.91.0
array_redimpresv_obj.c
Go to the documentation of this file.
1 /* redim preserve function */
2 
3 #include "fb.h"
4 
6  (
7  FBARRAY *array,
8  size_t element_len,
9  FB_DEFCTOR ctor,
10  FB_DEFCTOR dtor,
11  size_t dimensions,
12  ...
13  )
14 {
15  va_list ap;
16  int res;
17 
18  va_start( ap, dimensions );
19 
20  /* new? */
21  if( array->ptr == NULL )
22  {
23  res = fb_hArrayAlloc( array, element_len, FB_FALSE, ctor, dimensions, ap );
24  }
25  /* realloc.. */
26  else
27  {
28  FB_DTORMULT dtor_mult = (dtor != NULL? &fb_hArrayDtorObj : NULL );
29 
30  res = fb_hArrayRealloc( array, element_len, FB_FALSE, ctor, dtor_mult, dtor, dimensions, ap );
31  }
32 
33  va_end( ap );
34 
35  return res;
36 }