strlen in dstrings.c
This commit is contained in:
parent
f9aac70796
commit
16c80d2305
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
#include "dstring.h"
|
#include "dstring.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
// init
|
// init
|
||||||
int dstring_init (dstring* str, unsigned int memory){
|
int dstring_init (dstring* str, unsigned int memory){
|
||||||
@ -179,12 +180,7 @@ char* dstring_to_str_noinit(dstring* input){
|
|||||||
|
|
||||||
// convert from char*
|
// convert from char*
|
||||||
int str_to_dstring(char* str, dstring* output){
|
int str_to_dstring(char* str, dstring* output){
|
||||||
char* ptr;
|
dstring_init(output, strlen(str));
|
||||||
unsigned int str_len=0;
|
|
||||||
for(ptr=str;*ptr!='\0';ptr++){
|
|
||||||
str_len++;
|
|
||||||
}
|
|
||||||
dstring_init(output, str_len);
|
|
||||||
str_to_dstring_noinit(str, output);
|
str_to_dstring_noinit(str, output);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user