diff options
Diffstat (limited to 'structures')
| -rw-r--r-- | structures/rope/rope.c | 16 | ||||
| -rw-r--r-- | structures/rope/rope.h | 1 | 
2 files changed, 17 insertions, 0 deletions
| diff --git a/structures/rope/rope.c b/structures/rope/rope.c index 9e0d551..e1ae4a9 100644 --- a/structures/rope/rope.c +++ b/structures/rope/rope.c @@ -27,3 +27,19 @@ rope* rope_new()  	return tmp;  } + +rope* str_to_rope(str) +char *str; +{ +	rope *tmp; + +	if (!str) +		return NULL; + +	tmp = rope_new(); +	tmp->len = strlen(str); +	tmp->str = strdup(str); + +	return tmp; +} + diff --git a/structures/rope/rope.h b/structures/rope/rope.h index 4ffd726..80e60a3 100644 --- a/structures/rope/rope.h +++ b/structures/rope/rope.h @@ -4,5 +4,6 @@  typede struct rope_s rope;  rope* rope_new(); +rope* str_to_rope(char*);  #endif | 
