aboutsummaryrefslogtreecommitdiff
path: root/structures/rope/rope.c
diff options
context:
space:
mode:
authorTucker Evans <tucker@tuckerevans.com>2020-12-31 03:20:14 -0500
committerTucker Evans <tucker@tuckerevans.com>2020-12-31 03:20:14 -0500
commit435ab65d59f2a2eb1908a4b399049f6bfa0934e3 (patch)
tree4a45b493dd0f8cf56e379d589302d32e255aa034 /structures/rope/rope.c
parentbe0b9926ddcee4f6af1eef1091d48c919e611340 (diff)
Add func to embed a char* (str) into a rope
Diffstat (limited to 'structures/rope/rope.c')
-rw-r--r--structures/rope/rope.c16
1 files changed, 16 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;
+}
+