-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspymem.h
68 lines (55 loc) · 1.66 KB
/
spymem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#define TKN(t) #t
#ifndef DEBUG
#define smalloc(size) malloc(size)
#define sfree(ptr) free(ptr)
#define sSP_Realloc(ptr, size) SP_Realloc(ptr, size)
#define scalloc(nitems, size) calloc(nitems, size)
#define SP_malloc(size, list) malloc(size)
#define SP_free(ptr, list) free(ptr)
#define SP_Realloc(ptr, size, list) SP_Realloc(ptrs, size)
#define SP_calloc(nitems, size, list) calloc(nitems, size)
#else
#include <stddef.h>
#include <time.h>
#include "lists.h"
extern void * SP_malloc(size_t size, List * list);
extern void * SP_realloc(const void * ptr, size_t size, List* list, List* real);
extern void * SP_calloc(size_t nitems, size_t size, List * list);
extern void SP_free(const void * ptr, List * list, List * frees);
extern void * smalloc(size_t size);
extern void * srealloc(const void * ptr, size_t size);
extern void * scalloc(size_t nitems, size_t size);
extern void sfree(const void * ptr);
#endif
extern List * SP_heap;
extern List * SP_realls;
extern List * SP_frees;
extern void SP_start(void);
typedef struct SP_Reall {
const void * from,
* to;
size_t frmlen,
tolen,
id,
toid;
clock_t frmtimestamp,
totimestamp;
} SP_Reall;
typedef struct SP_Alloc {
const void * ptr;
clock_t timestamp;
size_t id;
} SP_Alloc;
typedef struct SP_Free {
const void * ptr;
clock_t frmtimestamp,
timestamp;
size_t id;
} SP_Free;
extern char * SP_printreall(const List * reall);
extern char * SP_printheap(const List * heap, signed long xpose);
extern char * SP_printfree(const List * frees);
extern char * sprintreall(void);
extern char * sprintheap(signed long xpose);
extern char * sprintfree(void);