Changeset 388 for trunk/Include/Classes/System/Environment.ab
- Timestamp:
- Nov 25, 2007, 4:31:35 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/Environment.ab
r337 r388 31 31 Static Function CurrentDirectory() As String 32 32 Dim size = GetCurrentDirectory(0, 0) 33 Dim p = _System_malloc(SizeOf (TCHAR) * size) As PCTSTR33 Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PCTSTR 34 34 Dim len = GetCurrentDirectory(size, p) 35 35 If len < size Then 36 36 CurrentDirectory = New String(p, size As Long) 37 _System_free(p)38 37 End If 39 38 End Function … … 92 91 If Object.ReferenceEquals(sysDir, Nothing) Then 93 92 Dim size = GetSystemDirectory(0, 0) 94 Dim p = _System_malloc(SizeOf (TCHAR) * size) As PTSTR93 Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR 95 94 Dim len = GetSystemDirectory(p, size) 96 95 sysDir = New String(p, len As Long) 97 _System_free(p)98 96 End If 99 97 Return sysDir … … 145 143 Dim src = ToTCStr(s) 146 144 Dim size = ExpandEnvironmentStrings(src, 0, 0) 147 Dim dst = _System_malloc(SizeOf (TCHAR) * size) As PTSTR145 Dim dst = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR 148 146 ExpandEnvironmentStrings(src, dst, size) 149 147 ExpandEnvironmentVariables = New String(dst, size - 1) 150 _System_free(dst)151 148 End Function 152 149 … … 160 157 Dim tcsVariable = ToTCStr(variable) 161 158 Dim size = _System_GetEnvironmentVariable(tcsVariable, 0, 0) 162 Dim p = _System_malloc(SizeOf (TCHAR) * size) As PTSTR159 Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR 163 160 Dim len = _System_GetEnvironmentVariable(tcsVariable, p, size) 164 161 GetEnvironmentVariable = New String(p, len As Long) 165 _System_free(p)166 162 End Function 167 163
Note:
See TracChangeset
for help on using the changeset viewer.