stedolan/jq — pull request #130 by 13ren (2013-05-22 20:03:51+00:00)
Title: libload_2 (update to pull request #126, for issue  #112)

I could *tell* you were ramping up to a release, and looks like my initial pull request *just* missed it! (though I agree it wasn't ready yet, just a first draft, so it wouldn't have gotten in anyway. But still).

OK, this now uses `builtins_bind`. I factored out the middle of the loop, so it could be reused. *BTW: there's similar code in `jq_compile_args` (execute.c) -- worth factoring out?*

In order to reuse `slurp_file` (main.c), I made it non-static, and created a `main.h`. *BTW: It might make more sense to extract it out into a `file_utils.c` or something - but I'll leave that architectural decision to you.*

I thought about Windows. Google/Stackoverflow says they seem to use something like %USER%/%APP% for config files, but I didn't see any guidance on doing that from C (it's all .NET/C#). I also don't have access to a Windows machine, so I wouldn't be able to test it anyway. We may need a Windows user/expert here...

Finally, I actually don't like using `~/.jq`, because there's no extension route. I don't know what other config info might be needed in future, but it would be nice if it was back-compatible. I'd kinda like to have `~/.jq` with a config line like "PATH=....". Or an environment variable (java classpath style). OTOH it's very early days.

I also added `.*.swp` to `.gitignore` (vim temp files). I was going to remove it from the pull release with a rebase, but forgot to. Then I thought, it does no harm, and may help other vim users. So it's up to you.

BTW: I'm using a different branch from #126 (trying to get the right git workflow), so that's why this doesn't add on to my previous pull request in #126.

Question: do you find it helpful for me to give an overview of the changes here, or is it just as quick to check the diff?