[Freeciv-Dev] (PR#9415) astring broken
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9415 >
astr_minsize is really astr_size. That is, it will reduce the size, not
just set a minimum size...
So astring_clear can't call astr_minsize(1) if the current size is
greater than 1. Doing so breaks all astrings everywhere. (This bug was
brought to you by Raimar and myself in PR#8720.)
This patch fixes it, the easy way. I will apply immediately. Later
perhaps we should rename astr_minsize...
jason
? diff
Index: utility/astring.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/astring.c,v
retrieving revision 1.10
diff -u -r1.10 astring.c
--- utility/astring.c 18 Jul 2004 01:30:52 -0000 1.10
+++ utility/astring.c 18 Jul 2004 02:38:13 -0000
@@ -145,6 +145,10 @@
{
assert(astr != NULL);
- astr_minsize(astr, 1);
+ if (astr->n == 0) {
+ /* astr_minsize is really astr_size, so we don't want to reduce the
+ * size. */
+ astr_minsize(astr, 1);
+ }
astr->str[0] = '\0';
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9415) astring broken,
Jason Short <=
|
|