Skip to content

Commit b9537df

Browse files
committed
Simplify, fix issue with -j mode and empty arrays
1 parent 5bf1be3 commit b9537df

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ all: jt
1212
clean:
1313
rm -f jt jt.1 jt.1.html *.o *.a *.tar *.gz
1414

15-
libjsmn.a: jsmn.o
16-
$(AR) rc $@ $^
17-
18-
%.o: %.c jsmn.h
15+
%.o: %.c
1916
$(CC) -c $(CFLAGS) $< -o $@
2017

21-
jt: jt.o libjsmn.a
18+
jt: jt.o
2219
$(CC) $(LDFLAGS) $^ -o $@
2320

2421
%.1: %.1.ronn

jt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <stdlib.h>
1010
#include <string.h>
1111
#include <unistd.h>
12-
#include "jsmn.h"
12+
#include "jsmn.c"
1313

1414
char *colsep = "\t";
1515
char *rowsep = "\n";
@@ -267,6 +267,7 @@ int run(char *js, int argc, char *argv[]) {
267267
if (data->size == 0) {
268268
stack_push(&IN, NULL);
269269
run(js, argc, argv);
270+
if (! left_join) cols = -STACKSIZE;
270271
} else {
271272
i = (int*) stack_head(ITR);
272273

@@ -320,7 +321,7 @@ int run(char *js, int argc, char *argv[]) {
320321

321322
else if (data) {
322323
data = obj_get(js, data, argv[0]);
323-
if (! (data || left_join)) return -1 * STACKSIZE;
324+
if (! (data || left_join)) return -STACKSIZE;
324325
stack_push(&IN, data);
325326
}
326327

0 commit comments

Comments
 (0)