From 16c80d230561ff52d53275477759d155f2abe2a6 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Fri, 3 Nov 2023 16:48:18 -0400 Subject: [PATCH] strlen in dstrings.c --- src/dstring.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/dstring.c b/src/dstring.c index 5a68143..134968a 100644 --- a/src/dstring.c +++ b/src/dstring.c @@ -17,6 +17,7 @@ limitations under the License. #include "dstring.h" #include #include +#include // init int dstring_init (dstring* str, unsigned int memory){ @@ -179,12 +180,7 @@ char* dstring_to_str_noinit(dstring* input){ // convert from char* int str_to_dstring(char* str, dstring* output){ - char* ptr; - unsigned int str_len=0; - for(ptr=str;*ptr!='\0';ptr++){ - str_len++; - } - dstring_init(output, str_len); + dstring_init(output, strlen(str)); str_to_dstring_noinit(str, output); return(0); }