1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4//#include <security_bsafe/bsafe.h>
5
6#define POINTER void *
7#define NULL_PTR NULL
8
9void T_free(POINTER block)
10{
11    if (block != NULL_PTR) {
12		free(block);
13    }
14}
15
16POINTER T_malloc(unsigned int len)
17{
18    return (POINTER) malloc(len ? len : 1);
19}
20
21/* these are not needed - they are in system.c in security_bsafe */
22#if 0
23int T_memcmp(POINTER firstBlock, POINTER secondBlock, unsigned int len)
24{
25    if (len == 0) {
26		return 0;
27    }
28    return memcmp(firstBlock, secondBlock, len);
29}
30
31void T_memcpy(POINTER output, POINTER input, unsigned int len)
32{
33    if (len != 0) {
34		memcpy(output, input, len);
35    }
36}
37
38void T_memmove(POINTER output, POINTER input, unsigned int len)
39{
40    if (len != 0) {
41		memmove(output, input, len);
42    }
43}
44
45void T_memset(POINTER output, int value, unsigned int len)
46{
47    if (len != 0) {
48		memset(output, value, len);
49    }
50}
51#endif
52
53POINTER T_realloc(POINTER block, unsigned int len)
54{
55    if (block == NULL_PTR)
56		return (POINTER) malloc(len ? len : 1);
57
58	return (POINTER)realloc(block, len);
59}
60