FreeBASIC  0.91.0
str_tempdescz.c
Go to the documentation of this file.
1 /* temp string descriptor allocation for zstring's */
2 
3 #include "fb.h"
4 
5 FBCALL FBSTRING *fb_StrAllocTempDescZEx( const char *str, ssize_t len )
6 {
7  FBSTRING *dsc;
8 
9  FB_STRLOCK();
10 
11  /* alloc a temporary descriptor */
12  dsc = fb_hStrAllocTmpDesc( );
13 
14  FB_STRUNLOCK();
15 
16  if( dsc == NULL )
17  return &__fb_ctx.null_desc;
18 
19  dsc->data = (char *)str;
20  dsc->len = len;
21  dsc->size = len;
22 
23  return dsc;
24 }
25 
27 {
28  ssize_t len;
29 
30  /* find the true size */
31  if( str != NULL )
32  len = strlen( str );
33  else
34  len = 0;
35 
36  return fb_StrAllocTempDescZEx( str, len );
37 }