Browse Source

Implemented search functions.

master
Cameron Weinfurt 1 year ago
parent
commit
6e2fe6b97f
  1. 41
      tree_alloc.c

41
tree_alloc.c

@ -0,0 +1,41 @@
#include "allocator_internal.h"
TreeAlloc *insert_node_at(void *address, int padding, int align, int size) {
return NULL;
}
TreeAlloc *search_by_address(TreeAlloc *root, void *address) {
while (1) {
if (root < address) {
if (root->left)
root = root->left;
else
return root;
} else if (root > address) {
if (root->right)
root = root->right;
else
return root;
} else {
return root;
}
}
}
TreeAlloc *search_by_size(TreeAlloc *root, int padding, int align, int size) {
while (1) {
if (root->size < size) {
if (root->left)
root = root->left;
else
return root;
} else if (root->size > address) {
if (root->right)
root = root->right;
else
return root;
} else {
return root;
}
}
}
Loading…
Cancel
Save