FreeBASIC  0.91.0
str_tempres.c
Go to the documentation of this file.
1 /* temp result string allocation */
2 
3 #include "fb.h"
4 
5 /*:::::*/
7 {
8  FBSTRING *dsc;
9 
10  FB_STRLOCK();
11 
12  /* alloc a temporary descriptor (the current one at stack will be trashed) */
13  dsc = fb_hStrAllocTmpDesc( );
14  if( dsc == NULL ) {
15  FB_STRUNLOCK();
16  return &__fb_ctx.null_desc;
17  }
18 
19  /* copy just the descriptor, setting it as a temp string */
20  dsc->data = src->data;
21  dsc->len = src->len | FB_TEMPSTRBIT;
22  dsc->size = src->size;
23 
24  /* just for safety.. */
25  src->data = NULL;
26  src->len = 0;
27  src->size = 0;
28 
29  FB_STRUNLOCK();
30 
31  return dsc;
32 }
33 
34