397 Commits

Author SHA1 Message Date
Heng Li
d5d1364e13 bug for empty []/{}; check extra left brackets 2014-11-29 12:09:47 -05:00
Heng Li
8218bf706e rename brackets 2014-11-29 12:05:12 -05:00
Heng Li
dc0386f103 added a bit error checking 2014-11-29 12:01:31 -05:00
Heng Li
cbc9adb418 A light-weight JSON parser 2014-11-29 11:48:11 -05:00
Heng Li
7163c21378 give kh_##name##_t a struct name 2014-11-28 21:04:38 -05:00
Heng Li
32cbd58a7f default to following redirect & no SSL certificate 2014-11-28 11:49:11 -05:00
Heng Li
5dd8a17941 Merge pull request #39 from jmarshall/kseq-eof
Fix ks_getuntil2() extra empty record at EOF bug
2014-11-13 10:38:57 -05:00
John Marshall
d60e5fc719 Fix ks_getuntil2() extra empty record at EOF bug
When the stream is an exact multiple of the buffer size, ks_getuntil2()
was returning a final empty record when it should have returned -1.
Fixed by moving the "EOF => return -1" check to after the read loop.

(See samtools/samtools#318 for an example of an error caused by a
spurious empty line at the end of a SAM file.)
2014-11-13 14:39:59 +00:00
John Marshall
fa08681542 Simplify 8d8d1a19f0c69b53d5ed8d9f6592dfa4b91c23f3 code changes 2014-11-13 11:57:56 +00:00
Heng Li
0306b20f19 Merge branch 'master' of github.com:attractivechaos/klib 2014-11-10 16:05:06 -05:00
Heng Li
8d8d1a19f0 bug with incomplete read() call
See also issue #43 of seqtk
2014-11-10 16:04:13 -05:00
Heng Li
d61ed77e61 Merge pull request #38 from immerrr/enable-inline-macro-overrides
Enable overriding kh_inline from user code
2014-10-13 16:41:25 -04:00
immerrr
66154d91be Enable overriding kh_inline from user code 2014-10-13 21:25:24 +04:00
Heng Li
b6427c9fc7 Merge pull request #28 from piki/fix-new_flags-leak
fix the leak that happens if krealloc fails
2014-09-21 19:05:45 -04:00
Heng Li
28c6d83079 Merge pull request #31 from jmarshall/warnings
Silence -Wstrict-prototypes and static analyser warnings in klist.h
2014-04-09 09:40:35 -04:00
John Marshall
f79c9162ee Silence -Wstrict-prototypes and static analyser warnings
Using "(void)" provides an explicit there-are-no-arguments prototype.
Using the exact type in "malloc(...sizeof)" is clearer and silences
warnings from clang's static analyzer.
2014-04-09 13:40:34 +01:00
Patrick Reynolds
000f0890f7 fix the leak that happens if krealloc fails 2014-02-09 02:24:08 -06:00
Heng Li
2818c5c5ac Merge branch 'master' of github.com:attractivechaos/klib 2013-12-07 09:28:32 -05:00
Heng Li
2a2e468fd3 don't seek when opening
If the input is a stream, it will always fail.
2013-12-07 09:27:50 -05:00
Heng Li
316e8028e2 Merge pull request #26 from zhanxw/patch-1
Update ksort.h
2013-12-01 09:27:44 -08:00
zhanxw
831b2f89d1 Update ksort.h
From my personal communication, I got this suggestion:

 using inline incorrectly: see the C99 standard §6.7.4.  Please change to static inline (and report upstream). This also caused some clang compilation problem.
2013-11-29 23:37:10 -05:00
Heng Li
1297bc9568 fixed a bug in seek 2013-11-24 14:59:37 -05:00
Heng Li
1e1ca279fd added a note about S3 2013-11-21 13:13:57 -05:00
Heng Li
14bd8882ee added HMAC-SHA1 to drop the openssl dependency 2013-11-21 12:51:44 -05:00
Heng Li
fbe14fb00f allow to feed change key/secret/id-file 2013-11-21 00:22:33 -05:00
Heng Li
e4228185a6 support the s3:// protocol 2013-11-21 00:13:05 -05:00
Heng Li
b333aaf179 halve the buffer size 2013-11-20 14:32:49 -05:00
Heng Li
b61eadc569 use fixed-length buffer with pause() 2013-11-20 14:18:19 -05:00
Heng Li
abfe6990de ignore signal 2013-11-20 11:23:02 -05:00
Heng Li
1666c82793 need to grow buffer
One multi_perform() frequently invokes multiple write_cb(). We have to use a
dynamic buffer. Hmm.. I really do not like the curl APIs, although I understand
why they are designed this way.
2013-11-18 22:07:40 -05:00
Heng Li
cd98307f5f wrong dopen() interface 2013-11-18 21:35:23 -05:00
Heng Li
400f32f102 forgot ";" 2013-11-18 21:04:58 -05:00
Heng Li
4d4298dc45 forgot to alias kurl_t to knetFile 2013-11-18 21:04:40 -05:00
Heng Li
c20d29ba47 emulating knetfile APIs 2013-11-18 21:03:25 -05:00
Heng Li
920f17669b added dopen()/buflen() and optional options 2013-11-18 20:42:28 -05:00
Heng Li
d9fadf5077 use larger buffer for remote files 2013-11-18 15:39:12 -05:00
Heng Li
81a72689fe Fixed slow sftp/scp connection
In curl/docs/examples/fopen.c, the developer didn't check maxfd set by
curl_multi_fdset() and supposed that calling select(0,...) is effectively
equivalent to sleep. While the comment is correct, timeout estimated by
curl_multi_fdset() is frequently too large - in my case 10 seconds. We seldom
need to wait that long.

In curl_multi_fdset.3, the cURL developers recommended to wait at least 100ms
if maxfd is set to 1. This is what I am doing in the revised code. It does
little harm.
2013-11-18 15:29:18 -05:00
Heng Li
23a2169c85 better CLI
sftp connection is really slow. Don't know why.
2013-11-18 12:18:34 -05:00
Heng Li
dd4e700725 better interface and documentations 2013-11-18 11:48:26 -05:00
Heng Li
7312ee6f82 knetfile-like interface to CURL 2013-11-18 10:55:21 -05:00
Heng Li
83c05ff208 forgot the header file
For kt_for() it is actually not needed.
2013-11-02 08:26:41 -04:00
Heng Li
7d5daa15e6 added a more flexible scheduler; not tested
not thoroughly
2013-10-11 13:17:26 -04:00
Heng Li
08fdd05b31 change the argument ordering 2013-10-11 09:34:42 -04:00
Heng Li
007ef52ce4 added the test program for kthread 2013-10-10 23:28:17 -04:00
Heng Li
a119f0a93f reduced a redundant variable; fix for wrong tid 2013-10-10 16:06:02 -04:00
Heng Li
a2164b941d wait-free heap-free implementation of kt_for()
and also much simpler
2013-10-10 12:39:12 -04:00
Heng Li
85febb4cd7 simplified the kt_for() API
* the local array can fit into the global data
 * sometimes caller needs to know thread id to maintain buffer
2013-10-10 10:37:14 -04:00
Heng Li
1808e58531 revert to kt_for()
the new version is buggy and even if I could fix it, I would not feel
confident. Perhaps I will come back later when I am more competent.
2013-10-10 00:20:08 -04:00
Heng Li
ef05b26815 test C++ spawn-final 2013-10-10 00:18:59 -04:00
Heng Li
e36f480126 more versatile APIs 2013-10-09 23:53:56 -04:00