src/lib/dystring.c 1.25

1.25 2009/11/13 19:01:56 kent
Adding dyStringWriteOne.
Index: src/lib/dystring.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/dystring.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -b -B -U 4 -r1.24 -r1.25
--- src/lib/dystring.c	20 Oct 2009 19:17:34 -0000	1.24
+++ src/lib/dystring.c	13 Nov 2009 19:01:56 -0000	1.25
@@ -74,12 +74,14 @@
 /* Append string of given size to end of string. */
 {
 int oldSize = ds->stringSize;
 int newSize = oldSize + stringSize;
-int newAllocSize = newSize + oldSize;
 char *buf;
 if (newSize > ds->bufSize)
+    {
+    int newAllocSize = newSize + oldSize;
     dyStringExpandBuf(ds,newAllocSize);
+    }
 buf = ds->string;
 memcpy(buf+oldSize, string, stringSize);
 ds->stringSize = newSize;
 buf[newSize] = 0;