Imported Upstream version 0.14.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2016-05-24 21:53:01 +02:00
parent fb3990e9e5
commit 41a01dbf05
529 changed files with 25112 additions and 2336 deletions

View file

@ -346,6 +346,7 @@ void dstr_ncopy(struct dstr *dst, const char *array, const size_t len)
dst->array = bmemdup(array, len + 1);
dst->len = len;
dst->capacity = len + 1;
dst->array[len] = 0;
}
@ -363,6 +364,7 @@ void dstr_ncopy_dstr(struct dstr *dst, const struct dstr *str, const size_t len)
newlen = size_min(len, str->len);
dst->array = bmemdup(str->array, newlen + 1);
dst->len = newlen;
dst->capacity = newlen + 1;
dst->array[newlen] = 0;
}
@ -430,10 +432,11 @@ void dstr_insert(struct dstr *dst, const size_t idx, const char *array)
new_len = dst->len + len;
dstr_ensure_capacity(dst, new_len + 1);
dst->len = new_len;
memmove(dst->array+idx+len, dst->array+idx, dst->len - idx + 1);
memcpy(dst->array+idx, array, len);
dst->len = new_len;
}
void dstr_insert_dstr(struct dstr *dst, const size_t idx,
@ -450,10 +453,11 @@ void dstr_insert_dstr(struct dstr *dst, const size_t idx,
new_len = dst->len + str->len;
dstr_ensure_capacity(dst, (new_len+1));
dst->len = new_len;
memmove(dst->array+idx+str->len, dst->array+idx, dst->len - idx + 1);
memcpy(dst->array+idx, str->array, str->len);
dst->len = new_len;
}
void dstr_insert_ch(struct dstr *dst, const size_t idx, const char ch)