Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cktan committed Jan 20, 2022
1 parent 0b8b203 commit c9e71bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
CC = gcc
CC = gcc-11
CFILES = csv.c
EXEC = csv2py csvsplit csvnorm csvstat csvecho

CFLAGS += -std=c99 -Wall -Wextra -mavx
CFLAGS += -std=c99 -Wall -Wextra -mavx2 -mfma -mbmi

# to compile for debug: make DEBUG=1
# to compile for no debug: make
ifdef DEBUG
CFLAGS += -O0 -g
else
# NOTE: on gcc 6, csvstat produced by -O2 runs faster than -O3
CFLAGS += -O2 -DNDEBUG
CFLAGS += -O3 -DNDEBUG
endif

LIB = libcsv.a
Expand Down
4 changes: 3 additions & 1 deletion csvecho.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ int main(int argc, char **argv) {

char **field;
int nfield;
csv_parse_t *cp = csv_open('\"', '\\', '|', "");
char nullstr[20];
nullstr[0] = 0;;
csv_parse_t *cp = csv_open('\"', '\\', '|', nullstr);

int n = csv_feed_last(cp, line, strlen(line), &field, &nfield);
if (n == -1) {
Expand Down
4 changes: 3 additions & 1 deletion csvsplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ static void prow(char *ptr, int len) {
}

void do_split(FILE *fp) {
csv_parse_t *cp = csv_open('"', '"', ',', "");
char nullstr[20];
nullstr[0] = 0;
csv_parse_t *cp = csv_open('"', '"', ',', nullstr);
if (!cp) {
fatal("csv_open failed");
}
Expand Down

0 comments on commit c9e71bc

Please sign in to comment.