Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --json-file/-j option to read from file w/ json contents #311

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0fbb22d
wip: simple json handling - needs big clean up
jacobmealey Apr 26, 2024
9e2f4a4
clean up source code
jacobmealey May 7, 2024
0bd91b6
added more tests, need to add special handling for queries
jacobmealey May 7, 2024
0e22840
finalized testing and found a bug where querys all stack together
jacobmealey May 10, 2024
e01fd50
query strings generating. need to fix for iteration
jacobmealey May 11, 2024
3d55d30
cleaning up for pr
jacobmealey May 14, 2024
dcea792
test w/ actions
jacobmealey May 14, 2024
41bb29e
Added sudo back
jacobmealey May 14, 2024
18ecad7
put json objects
jacobmealey May 15, 2024
29de2be
remove putting whole object?
jacobmealey May 15, 2024
a1d0ed8
removed whole line
jacobmealey May 15, 2024
ba76262
fixed memory issues
jacobmealey May 15, 2024
5618105
remove sanitizer
jacobmealey May 15, 2024
1d9d70d
spelling
jacobmealey May 15, 2024
1685194
attempting to make everything play nice
jacobmealey May 15, 2024
0785c94
fixed typo
jacobmealey May 15, 2024
5264619
different packages and paths
jacobmealey May 15, 2024
20c3b8c
cleaned up tests
jacobmealey May 15, 2024
73b272a
removed mac os specifics from makefile, clean style
jacobmealey May 15, 2024
95fa596
remove params putting
jacobmealey May 15, 2024
26e4859
not leaking
jacobmealey May 15, 2024
bb1a0e3
free this_query
jacobmealey May 15, 2024
373bec0
clean up for pr
jacobmealey May 16, 2024
1851fee
cleanup file handling
jacobmealey May 16, 2024
cc74cdf
get other actions working -- need to get curl for win working
jacobmealey May 16, 2024
b44e296
undo file cleanup... doesn't work on windows
jacobmealey May 16, 2024
542fe6a
put json in behind a flag
jacobmealey May 17, 2024
6ceea4a
fix whitespace in tests.json
jacobmealey May 17, 2024
12e6725
white space Update .github/workflows/makefile.yml
jacobmealey May 17, 2024
6eb908e
Update homebrew includes .github/workflows/makefile.yml
jacobmealey May 17, 2024
292fd77
Update .github/workflows/makefile.yml
jacobmealey May 17, 2024
a8dad0a
make --json-file act like other optional builds
jacobmealey May 17, 2024
ad93491
Merge branch 'trurl-json-in' of github.com:jacobmealey/urler into tru…
jacobmealey May 17, 2024
aa39f61
Make it act as a filter
jacobmealey May 24, 2024
e5e2429
added error check for parts key
jacobmealey May 24, 2024
ede3153
style
jacobmealey May 24, 2024
aa7d58b
update oom messaging
jacobmealey May 24, 2024
d2b3fca
cleanup makefile
jacobmealey May 24, 2024
2f81538
Update Makefile
jacobmealey May 24, 2024
3975591
flip around the lines
jacobmealey May 24, 2024
1c22c47
makefile JSON_C_PREFIX, update readme
jacobmealey Jun 11, 2024
e6f135e
cleanup readme
jacobmealey Jun 11, 2024
a947832
trying setting json_c_path in GITHUB_ENV
jacobmealey Jun 11, 2024
7502449
prefix not path
jacobmealey Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ ifndef NDEBUG
CFLAGS += -g
endif
ifdef TRURL_JSON_IN
CFLAGS += -DTRURL_JSON_IN -Wno-gnu
LDLIBS += -ljson-c
CFLAGS += -DTRURL_JSON_IN -Wno-gnu -I /opt/homebrew/include
LDLIBS += -ljson-c -L /opt/homebrew/lib
jacobmealey marked this conversation as resolved.
Show resolved Hide resolved
endif
MANUAL = trurl.1

Expand Down
4 changes: 2 additions & 2 deletions trurl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ static void from_json(FILE *file, struct option *o)
memset(reading_buff, 0, sizeof(char) * JSON_INIT_SIZE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why clear this? It seems unnecessary.

if(!json_string) {
free(json_string);
errorf(o, ERROR_MEM, "Error allocating memory for file operations");
errorf(o, ERROR_MEM, "out of memory while reading JSON string.");
}
size_t i = 0;
int num_brackets = 0, prev_num_brackets = 0;
Expand Down Expand Up @@ -1798,7 +1798,7 @@ static void from_json(FILE *file, struct option *o)
json_string = realloc(json_string, json_buf_size);
if(!json_string) {
errorf(o, ERROR_MEM,
"Unable to allocate memory for JSON string.");
"out of memory while reading JSON string.");
}
}
memcpy(json_string + last_write, reading_buff, JSON_INIT_SIZE);
Expand Down