Update of /cvsroot/q-lang/q-csv
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9029
Modified Files:
csv.c
Log Message:
convert quote delimiter to system encoding
Index: csv.c
===================================================================
RCS file: /cvsroot/q-lang/q-csv/csv.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** csv.c 25 Jan 2008 22:09:46 -0000 1.15
--- csv.c 11 Feb 2008 02:15:00 -0000 1.16
***************
*** 55,61 ****
return __FAIL;
! if (!(s = bf = (char *)malloc(sz)))
return __ERROR;
n_qt_s = strlen(qt_s);
while (1) {
--- 55,66 ----
return __FAIL;
! if (!(qt_s = from_utf8(qt_s, NULL)))
return __ERROR;
+ if (!(s = bf = (char *)malloc(sz))) {
+ free(qt_s);
+ return __ERROR;
+ }
+
n_qt_s = strlen(qt_s);
while (1) {
***************
*** 63,67 ****
if (n + BSIZE > sz) {
if (!(tb = realloc(bf, sz <<= 1))) {
! free(bf);
return __ERROR;
}
--- 68,72 ----
if (n + BSIZE > sz) {
if (!(tb = realloc(bf, sz <<= 1))) {
! free(bf); free(qt_s);
return __ERROR;
}
***************
*** 70,74 ****
fgets(s, BSIZE, fp);
if (ferror(fp)) {
! free(bf);
return __ERROR;
}
--- 75,79 ----
fgets(s, BSIZE, fp);
if (ferror(fp)) {
! free(bf); free(qt_s);
return __ERROR;
}
***************
*** 88,92 ****
fini:
s = to_utf8(bf, NULL);
! free(bf);
return mkstr(s);
}
--- 93,97 ----
fini:
s = to_utf8(bf, NULL);
! free(bf); free(qt_s);
return mkstr(s);
}
|