All pastes #24268 Raw Edit

Stuff

public text v1 · immutable
#24268 ·published 2005-09-30 00:40 UTC
rendered paste body
void* malloc(int size) {
	char* base = heap;
	int offset;
	
	for (offset = 0; offset < size + 4; offset++) {
		if (*(base + offset) != 0)
		{
			base = base + offset + *(int*)(base + offset) + 4;
			offset = 0;
		}
	}
	
	*(int*)base = size;
	return base + 4;
}