comparison src/readpst.c @ 38:f5c024aa1dc5 stable-0-5-9

more valgrind fixes
author carl
date Sun, 12 Aug 2007 14:30:15 -0700
parents ddfb25318812
children 2ad7ef0a3c4f
comparison
equal deleted inserted replaced
37:ddfb25318812 38:f5c024aa1dc5
820 y = chr_count(str, ',') 820 y = chr_count(str, ',')
821 + chr_count(str, '\\') 821 + chr_count(str, '\\')
822 + chr_count(str, ';') 822 + chr_count(str, ';')
823 + chr_count(str, '\n'); 823 + chr_count(str, '\n');
824 z = chr_count(str, '\r'); 824 z = chr_count(str, '\r');
825 x = strlen(str) + y - z + 1; // don't forget room for the NUL
826 if (y == 0 && z == 0) 825 if (y == 0 && z == 0)
827 // there isn't any extra space required 826 // there isn't any extra space required
828 ret = str; 827 ret = str;
829 else { 828 else {
829 x = strlen(str) + y - z + 1; // don't forget room for the NUL
830 buf = (char*) realloc(buf, x); 830 buf = (char*) realloc(buf, x);
831 a = str; 831 a = str;
832 b = buf; 832 b = buf;
833 while (*a != '\0') { 833 while (*a != '\0') {
834 switch (*a) { 834 switch (*a) {