Skip to content

Commit

Permalink
added ks_resize()
Browse files Browse the repository at this point in the history
  • Loading branch information
Heng Li committed Sep 23, 2011
1 parent 5bf30c2 commit e1dfef7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion kstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,16 @@ extern "C" {
#ifdef __cplusplus
}
#endif


static inline void ks_resize(kstring_t *s, size_t size)
{
if (s->m < size) {
s->m = size;
kroundup32(s->m);
s->s = (char*)realloc(s->s, s->m);
}
}

static inline int kputsn(const char *p, int l, kstring_t *s)
{
if (s->l + l + 1 >= s->m) {
Expand Down

0 comments on commit e1dfef7

Please sign in to comment.