X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/ed10f40b1520cef2fa633c94289ff9f3241bb3f6..8bca8773b4e2542f9537b8403764867aa76273a5:/sds.c diff --git a/sds.c b/sds.c index 6d18d1fd..8d1edcb7 100644 --- a/sds.c +++ b/sds.c @@ -1,6 +1,6 @@ /* SDSLib, A C dynamic strings library * - * Copyright (c) 2006-2009, Salvatore Sanfilippo + * Copyright (c) 2006-2010, Salvatore Sanfilippo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -140,7 +140,7 @@ sds sdscpylen(sds s, char *t, size_t len) { size_t totlen = sh->free+sh->len; if (totlen < len) { - s = sdsMakeRoomFor(s,len-totlen); + s = sdsMakeRoomFor(s,len-sh->len); if (s == NULL) return NULL; sh = (void*) (s-(sizeof(struct sdshdr))); totlen = sh->free+sh->len; @@ -159,7 +159,7 @@ sds sdscpy(sds s, char *t) { sds sdscatprintf(sds s, const char *fmt, ...) { va_list ap; char *buf, *t; - size_t buflen = 32; + size_t buflen = 16; while(1) { buf = zmalloc(buflen);