62684604c618f3e8c125b5bd077e7756ba5d7861
kent
  Tue Feb 1 12:02:18 2011 -0800
Making dyString expand by at least 1.5x if it needs to expand.
diff --git src/lib/dystring.c src/lib/dystring.c
index ff2055b..6cb2a2f 100644
--- src/lib/dystring.c
+++ src/lib/dystring.c
@@ -67,30 +67,33 @@
 /* Force dyString buffer to be at least given size. */
 {
 if (ds->bufSize < size)
     dyStringExpandBuf(ds, size);
 }
 
 void dyStringAppendN(struct dyString *ds, char *string, int stringSize)
 /* Append string of given size to end of string. */
 {
 int oldSize = ds->stringSize;
 int newSize = oldSize + stringSize;
 char *buf;
 if (newSize > ds->bufSize)
     {
     int newAllocSize = newSize + oldSize;
+    int oldSizeTimesOneAndAHalf = oldSize * 1.5;
+    if (newAllocSize < oldSizeTimesOneAndAHalf)
+        newAllocSize = oldSizeTimesOneAndAHalf;
     dyStringExpandBuf(ds,newAllocSize);
     }
 buf = ds->string;
 memcpy(buf+oldSize, string, stringSize);
 ds->stringSize = newSize;
 buf[newSize] = 0;
 }
 
 char dyStringAppendC(struct dyString *ds, char c)
 /* Append char to end of string. */
 {
 char *s;
 if (ds->stringSize >= ds->bufSize)
      dyStringExpandBuf(ds, ds->bufSize+256);
 s = ds->string + ds->stringSize++;