FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
str_ltrim.c
Go to the documentation of this file.
1
/* ltrim$ function */
2
3
#include "
fb.h
"
4
5
FBCALL
FBSTRING
*
fb_LTRIM
(
FBSTRING
*src )
6
{
7
FBSTRING
*dst;
8
ssize_t len;
9
char
*src_ptr =
NULL
;
10
11
if
( src ==
NULL
)
12
return
&
__fb_ctx
.
null_desc
;
13
14
FB_STRLOCK
();
15
16
if
( src->
data
!=
NULL
)
17
{
18
src_ptr =
fb_hStrSkipChar
( src->
data
,
FB_STRSIZE
( src ), 32 );
19
len =
FB_STRSIZE
( src ) - (ssize_t)(src_ptr - src->
data
);
20
}
21
else
22
len = 0;
23
24
if
( len > 0 )
25
{
26
/* alloc temp string */
27
dst =
fb_hStrAllocTemp_NoLock
(
NULL
, len );
28
if
( dst !=
NULL
)
29
{
30
/* simple copy */
31
fb_hStrCopy
( dst->
data
, src_ptr, len );
32
}
33
else
34
dst = &
__fb_ctx
.
null_desc
;
35
}
36
else
37
dst = &
__fb_ctx
.
null_desc
;
38
39
/* del if temp */
40
fb_hStrDelTemp_NoLock
( src );
41
42
FB_STRUNLOCK
();
43
44
return
dst;
45
}
rtlib
str_ltrim.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4