2222''
2323
2424#include once "CWikiConDir.bi"
25+ #include once "fbdoc_string.bi"
2526#include once "file.bi"
2627#include "crt/stdlib.bi"
2728#include "crt/string.bi"
@@ -36,7 +37,7 @@ end extern
3637namespace fb.fbdoc
3738
3839 type CWikiConDirCtx_
39- as zstring ptr path
40+ as zstring ptr path
4041 as zstring ptr pagename
4142 as integer pageid
4243 end type
@@ -50,10 +51,7 @@ namespace fb.fbdoc
5051 )
5152
5253 ctx = new CWikiConDirCtx
53-
54- ctx->path = allocate( len( *path ) + 1 )
55- *ctx->path = *path
56-
54+ ZSet @ctx->path, path
5755 ctx->pagename = NULL
5856 ctx->pageid = - 1
5957
@@ -63,21 +61,12 @@ namespace fb.fbdoc
6361 destructor CWikiConDir _
6462 ( _
6563 )
66-
64+
6765 if ( ctx = NULL ) then
6866 exit destructor
6967 end if
70-
71- if ( ctx->path <> NULL ) then
72- deallocate( ctx->path )
73- ctx->path = NULL
74- end if
75-
76- if ( ctx->pagename <> NULL ) then
77- deallocate( ctx->pagename )
78- ctx->pagename = NULL
79- end if
80-
68+ ZFree @ctx->path
69+ ZFree @ctx->pagename
8170 delete ctx
8271
8372 end destructor
@@ -94,14 +83,13 @@ namespace fb.fbdoc
9483
9584 function = FALSE
9685 body = ""
97-
86+
9887 if ( ctx = NULL ) then
9988 exit function
10089 end if
10190
91+ ZSet @ctx->pagename, pagename
10292 ctx->pageid = - 1
103- ctx->pagename = reallocate( ctx->pagename, len( *pagename ) + 1 )
104- *ctx->pagename = *pagename
10593
10694 sLocalFile = *ctx->path & *ctx->pagename & cache_ext
10795
@@ -190,13 +178,12 @@ namespace fb.fbdoc
190178 end if
191179
192180 ctx->pageid = - 1
193- ctx->pagename = reallocate( ctx->pagename, len( *page ) + 1 )
194- *ctx->pagename = *page
181+ ZSet @ctx->pagename, page
195182
196183 scan_cache_dir( *ctx->path, body )
197-
184+
198185 function = TRUE
199-
186+
200187 end function
201188
202189 '':::::
@@ -253,8 +240,7 @@ namespace fb.fbdoc
253240 return FALSE
254241 end if
255242
256- ctx->pagename = reallocate( ctx->pagename, len( *pagename ) + 1 )
257- *ctx->pagename = *pagename
243+ ZSet @ctx->pagename, pagename
258244
259245 return StorePage( body, NULL )
260246
@@ -274,4 +260,3 @@ namespace fb.fbdoc
274260 end function
275261
276262end namespace
277-
0 commit comments