Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Actual implementation of stringcat would be handy

  • Loading branch information...
commit 184ca4d514904a5b48561430d7054fb233631845 1 parent 5e44ee9
@jaytaph jaytaph authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/components/general/string.c
View
13 src/components/general/string.c
@@ -102,14 +102,19 @@ t_string *string_strdup(t_string *s) {
t_string *string_strcat0(t_string *dst, const char *src) {
- t_string *str = string_new();
- return str;
+ t_string *s = char0_to_string(src);
+ return string_strcat(dst, s);
}
t_string *string_strcat(t_string *dst, const t_string *src) {
- t_string *str = string_new();
- return str;
+ dst->val = (char *)smm_realloc(dst->val, dst->len + src->len);
+ memcpy(dst->val + dst->len, src->val, src->len);
+ dst->val[dst->len + src->len] = '\0';
+ dst->len += src->len;
+
+ return dst;
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.