summaryrefslogtreecommitdiff
path: root/bowshock/source/runtime/delete_objects.cxx
blob: aee39ecc5ed0653462624fde1026f57f390944cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright 2022-2023 Gabriel Bjørnager Jensen.

#include <bow/runtime.hxx>

#include <cstdio>
#include <fmt/core.h>

auto ::bow::delete_objects(::bow::ObjectRoot const& root) noexcept -> void {
	::fmt::print(stderr, "freeing objects\n");

	::bow::Object* object;
	::bow::Object* next;

	for (object = root.objects; object != nullptr; object = next) {
		::fmt::print(stderr, "freeing object of type {}", ::bow::object_type_string(object->type));

		next = object->next;
		delete object;
	}
}