FreeBASIC  0.91.0
array_erase.c
Go to the documentation of this file.
1 /* ERASE for dynamic arrays: free the array */
2 
3 #include "fb.h"
4 
5 FBCALL int fb_ArrayErase( FBARRAY *array, int isvarlen /* legacy */ )
6 {
7  /* ptr can be NULL, for global dynamic arrays that were never allocated,
8  but will still be destroyed on program exit */
9  if( array->ptr ) {
10  if( isvarlen )
11  fb_ArrayDestructStr( array );
12  free( array->ptr );
13  fb_ArrayResetDesc( array );
14  }
15 
16  return fb_ErrorSetNum( FB_RTERROR_OK );
17 }