diff options
-rw-r--r-- | structures/rope/rope.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/structures/rope/rope.c b/structures/rope/rope.c index e1ae4a9..f3828df 100644 --- a/structures/rope/rope.c +++ b/structures/rope/rope.c @@ -28,6 +28,18 @@ rope* rope_new() return tmp; } +size_t rope_len(root) +rope *root; +{ + if (!root) + return 0; + + if (root->str) + return strlen(root->str); + + return rope_len(root->left) + rope_len(root->right); +} + rope* str_to_rope(str) char *str; { |