diff options
Diffstat (limited to 'structures')
-rw-r--r-- | structures/rope/rope.c | 29 | ||||
-rw-r--r-- | structures/rope/rope.h | 8 |
2 files changed, 37 insertions, 0 deletions
diff --git a/structures/rope/rope.c b/structures/rope/rope.c new file mode 100644 index 0000000..9e0d551 --- /dev/null +++ b/structures/rope/rope.c @@ -0,0 +1,29 @@ +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <assert.h> +#include "rope.h" + +struct rope_s { + size_t len; + char *str; + + struct rope_s *left, *right, *parent; +}; + + +rope* rope_new() +{ + rope *tmp; + + tmp = malloc(sizeof(rope)); + assert(tmp); + + tmp->len = 0; + tmp->str = NULL; + tmp->left = NULL; + tmp->right = NULL; + tmp->parent = NULL; + + return tmp; +} diff --git a/structures/rope/rope.h b/structures/rope/rope.h new file mode 100644 index 0000000..4ffd726 --- /dev/null +++ b/structures/rope/rope.h @@ -0,0 +1,8 @@ +#ifndef ROPE_H +#define ROPE_H + +typede struct rope_s rope; + +rope* rope_new(); + +#endif |