Commit 40a2ed27 authored by Tarek Issa's avatar Tarek Issa
Browse files

Update httplib.c

parent baef0d94
#include <assert.h>
#include "httplib.h"
string* str_cat(string* dest, const char* src, size_t len) {
string* str_cat(string* dest, const char* src,size_t len){
if(len <= 0 ) return NULL;
if(dest == NULL) return NULL;
//Die größe des dest-Array wird um len bytes erweitert.
//if (realloc(dest->str, dest->len * len ) == NULL) return NULL;
if (realloc(dest->str, dest->pos+ (len) ) == NULL) return NULL;
int *ptr_last_array = 0;
ptr_last_array = (int*)(dest->str+dest->pos);
memcpy(ptr_last_array ,src, len);
dest->pos += len -1 ;
return dest;
} //Ludwig
string* new_string(size_t len) {
string* str = calloc(sizeof(string), 1);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment