Added optional pointer return in TraceNextN
This commit is contained in:
parent
d3722aac83
commit
840b19adf2
2 changed files with 9 additions and 6 deletions
|
@ -158,10 +158,12 @@ int TracingHeap_TraceNext(TracingHeap* self)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
size_t TracingHeap_TraceNextN(TracingHeap* self, size_t n)
|
||||
size_t TracingHeap_TraceNextN(TracingHeap* self, size_t n, int* error_code)
|
||||
{
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
if (TracingHeap_TraceNext(self)) {
|
||||
int trace_code = TracingHeap_TraceNext(self);
|
||||
if (trace_code != EXIT_SUCCESS) {
|
||||
if (error_code != NULL) *error_code = trace_code;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,16 +49,17 @@ typedef struct TracingHeap_s {
|
|||
allocator_t* allocator;
|
||||
} TracingHeap;
|
||||
|
||||
int TracingHeap_Create(TracingHeap* self, allocator_t* allocator);
|
||||
void TracingHeap_Destroy(TracingHeap* self);
|
||||
int TracingHeap_Create(TracingHeap* self, allocator_t* allocator);
|
||||
void TracingHeap_Destroy(TracingHeap* self);
|
||||
|
||||
void* TracingHeap_Allocate(TracingHeap* self, size_t bytes);
|
||||
void* TracingHeap_Allocate(TracingHeap* self, size_t bytes);
|
||||
|
||||
int TracingHeap_BeginTrace(TracingHeap* self);
|
||||
bool TracingHeap_IsTraceFinished(TracingHeap* self);
|
||||
int TracingHeap_EndTrace(TracingHeap* self);
|
||||
|
||||
int TracingHeap_TraceNext(TracingHeap* self);
|
||||
size_t TracingHeap_TraceNextN(TracingHeap* self, size_t n);
|
||||
size_t TracingHeap_TraceNextN(TracingHeap* self, size_t n, int* error_code);
|
||||
int TracingHeap_AddTracingRoot(TracingHeap* self, void* data);
|
||||
|
||||
#endif // header
|
||||
|
|
Loading…
Reference in a new issue