@@ -53,8 +53,8 @@ typedef _W64 unsigned int uintptr_t;
5353* size_t alignment - alignment of memory
5454*
5555* Exit:
56- * Sucess : Pointer to memory block
57- * Faliure : Null
56+ * Success : Pointer to memory block
57+ * Failure : Null
5858*******************************************************************************/
5959
6060void * __stdcall xr_aligned_malloc (size_t size, size_t alignment)
@@ -76,8 +76,8 @@ void* __stdcall xr_aligned_malloc(size_t size, size_t alignment)
7676* size_t offset - offset of memory from the alignment
7777*
7878* Exit:
79- * Sucess : Pointer to memory block
80- * Faliure : Null
79+ * Success : Pointer to memory block
80+ * Failure : Null
8181*
8282*******************************************************************************/
8383
@@ -88,7 +88,7 @@ void* __stdcall xr_aligned_offset_malloc(size_t size, size_t align, size_t offse
8888 if (!IS_2_POW_N (align))
8989 {
9090 errno = EINVAL;
91- return NULL ;
91+ return nullptr ;
9292 }
9393 if (offset >= size && offset != 0 )
9494 size = offset + 1 ;
@@ -98,8 +98,8 @@ void* __stdcall xr_aligned_offset_malloc(size_t size, size_t align, size_t offse
9898 /* gap = number of bytes needed to round up offset to align with PTR_SZ*/
9999 gap = (0 - offset) & (PTR_SZ - 1 );
100100
101- if ((ptr = (uintptr_t )malloc (PTR_SZ + gap + align + size)) == (uintptr_t )NULL )
102- return NULL ;
101+ if ((ptr = (uintptr_t )malloc (PTR_SZ + gap + align + size)) == (uintptr_t )nullptr )
102+ return nullptr ;
103103
104104 retptr = ((ptr + PTR_SZ + gap + align + offset) & ~align) - offset;
105105 ((uintptr_t *)(retptr - gap))[-1 ] = ptr;
@@ -127,8 +127,8 @@ void* __stdcall xr_aligned_offset_malloc(size_t size, size_t align, size_t offse
127127* size_t alignment - alignment of memory
128128*
129129* Exit:
130- * Sucess : Pointer to re-allocated memory block
131- * Faliure : Null
130+ * Success : Pointer to re-allocated memory block
131+ * Failure : Null
132132*
133133*******************************************************************************/
134134
@@ -158,8 +158,8 @@ void* __stdcall xr_aligned_realloc(void* memblock, size_t size, size_t alignment
158158* size_t offset - offset of memory from the alignment
159159*
160160* Exit:
161- * Sucess : Pointer to the re-allocated memory block
162- * Faliure : Null
161+ * Success : Pointer to the re-allocated memory block
162+ * Failure : Null
163163*
164164*******************************************************************************/
165165
@@ -169,19 +169,19 @@ void* __stdcall xr_aligned_offset_realloc(void* memblock, size_t size, size_t al
169169 uintptr_t movsz, reqsz;
170170 int bFree = 0 ;
171171
172- if (memblock == NULL )
172+ if (memblock == nullptr )
173173 {
174174 return xr_aligned_offset_malloc (size, align, offset);
175175 }
176176 if (size == 0 )
177177 {
178178 xr_aligned_free (memblock);
179- return NULL ;
179+ return nullptr ;
180180 }
181181 if (offset >= size && offset != 0 )
182182 {
183183 errno = EINVAL;
184- return NULL ;
184+ return nullptr ;
185185 }
186186
187187 stptr = (uintptr_t )memblock;
@@ -195,7 +195,7 @@ void* __stdcall xr_aligned_offset_realloc(void* memblock, size_t size, size_t al
195195 if (!IS_2_POW_N (align))
196196 {
197197 errno = EINVAL;
198- return NULL ;
198+ return nullptr ;
199199 }
200200
201201 align = (align > PTR_SZ ? align : PTR_SZ) - 1 ;
@@ -220,16 +220,16 @@ void* __stdcall xr_aligned_offset_realloc(void* memblock, size_t size, size_t al
220220 */
221221 if ((stptr + align + PTR_SZ + gap) < (uintptr_t )memblock)
222222 {
223- if ((ptr = (uintptr_t )malloc (reqsz)) == (uintptr_t )NULL )
224- return NULL ;
223+ if ((ptr = (uintptr_t )malloc (reqsz)) == (uintptr_t )nullptr )
224+ return nullptr ;
225225 bFree = 1 ;
226226 }
227227 else
228228 {
229- if ((ptr = (uintptr_t )_expand ((void *)stptr, reqsz)) == (uintptr_t )NULL )
229+ if ((ptr = (uintptr_t )_expand ((void *)stptr, reqsz)) == (uintptr_t )nullptr )
230230 {
231- if ((ptr = (uintptr_t )malloc (reqsz)) == (uintptr_t )NULL )
232- return NULL ;
231+ if ((ptr = (uintptr_t )malloc (reqsz)) == (uintptr_t )nullptr )
232+ return nullptr ;
233233 bFree = 1 ;
234234 }
235235 else
@@ -269,7 +269,7 @@ void __stdcall xr_aligned_free(void* memblock)
269269{
270270 uintptr_t ptr;
271271
272- if (memblock == NULL )
272+ if (memblock == nullptr )
273273 return ;
274274
275275 ptr = (uintptr_t )memblock;
@@ -282,11 +282,11 @@ void __stdcall xr_aligned_free(void* memblock)
282282 free ((void *)ptr);
283283}
284284
285- u32 __stdcall xr_aligned_msize (void * memblock)
285+ size_t __stdcall xr_aligned_msize (void * memblock)
286286{
287287 uintptr_t ptr;
288288
289- if (memblock == NULL )
289+ if (memblock == nullptr )
290290 return 0 ;
291291
292292 ptr = (uintptr_t )memblock;
@@ -296,5 +296,5 @@ u32 __stdcall xr_aligned_msize(void* memblock)
296296
297297 /* ptr is the pointer to the start of memory block*/
298298 ptr = *((uintptr_t *)ptr);
299- return ( u32 ) _msize ((void *)ptr);
299+ return _msize ((void *)ptr);
300300}
0 commit comments