diff options
| author | Tucker Evans <tucker@tuckerevans.com> | 2021-01-03 23:19:26 -0500 | 
|---|---|---|
| committer | Tucker Evans <tucker@tuckerevans.com> | 2021-01-03 23:19:26 -0500 | 
| commit | 54877babe8700bc39c7e2f8528e5146ed2fe6831 (patch) | |
| tree | f9d2a298879e701411df88a486ae333c48d74ed8 /structures | |
| parent | 18020f74d43758be53351a05129f771099257c6b (diff) | |
Add free function for ropes
Note: Does free entire tree.
Diffstat (limited to 'structures')
| -rw-r--r-- | structures/rope/rope.c | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/structures/rope/rope.c b/structures/rope/rope.c index 6e79b24..4719b18 100644 --- a/structures/rope/rope.c +++ b/structures/rope/rope.c @@ -28,6 +28,21 @@ rope* rope_new()  	return tmp;  } +void rope_free(root) +rope *root; +{ +	if (root->str) +		free(root->str); +	if (root->left) +		free(root->left); +	if (root->right) +		free(root->right); + +	free(root); + +	return; +} +  void rope_debug_print_aux(root, s)  rope *root;  int s; | 
