28 lines
590 B
C
28 lines
590 B
C
#define DEBUG
|
|
#include <stdio.h>
|
|
#include "../include/arena.h"
|
|
#include "../include/except.h"
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
#define BUFSZ MB(20)
|
|
|
|
static bool isZeroed(void *memory, unsigned int size){
|
|
unsigned char *mm = (unsigned char*)memory;
|
|
|
|
// early out for empty size
|
|
if (size == 0) return true;
|
|
|
|
return (*mm == 0) && memcmp(mm, mm + 1, size - 1) == 0;
|
|
}
|
|
|
|
int main(void){
|
|
|
|
Arena a = arena_new(BUFSZ, NOZERO | SOFTFAIL);
|
|
ASSERTED(a.beg != NULL);
|
|
ASSERTED(isZeroed(a.beg, BUFSZ) == false);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|