ferret 0.11.8.6 → 0.11.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{README → README.md} +3 -6
- data/Rakefile +7 -7
- data/{TUTORIAL → TUTORIAL.md} +0 -0
- data/ext/BZLIB_blocksort.c +2 -2
- data/ext/BZLIB_bzlib.c +4 -10
- data/ext/BZLIB_compress.c +2 -2
- data/ext/BZLIB_crctable.c +2 -2
- data/ext/BZLIB_decompress.c +22 -2
- data/ext/BZLIB_huffman.c +2 -2
- data/ext/BZLIB_randtable.c +2 -2
- data/ext/bitvector.c +6 -6
- data/ext/bzlib.h +2 -2
- data/ext/bzlib_private.h +11 -5
- data/ext/compound_io.c +1 -1
- data/ext/document.c +6 -9
- data/ext/except.c +2 -2
- data/ext/except.h +2 -2
- data/ext/field_index.c +1 -1
- data/ext/global.c +21 -30
- data/ext/global.h +2 -0
- data/ext/index.c +13 -6
- data/ext/index.h +4 -1
- data/ext/internal.h +1 -0
- data/ext/multimapper.c +1 -1
- data/ext/q_fuzzy.c +2 -1
- data/ext/q_span.c +1 -1
- data/ext/r_analysis.c +1 -1
- data/ext/r_index.c +2 -2
- data/ext/r_qparser.c +1 -3
- data/ext/r_search.c +7 -6
- data/ext/r_store.c +2 -0
- data/ext/scanner.c +50 -45
- data/ext/scanner_mb.c +51 -46
- data/ext/scanner_utf8.c +56 -51
- data/ext/search.c +2 -1
- data/ext/sort.c +2 -5
- data/lib/ferret/version.rb +1 -1
- data/test/unit/index/tc_index.rb +4 -6
- metadata +8 -9
- data/setup.rb +0 -1555
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e72c061a77aa3e4cf6e82525a102ccf10517b949
|
4
|
+
data.tar.gz: dc4af1937f19310f827ddc8ecaead7745a0a1d25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbf72dbe1900dceebee48f1cf38179beefaa98aff7ef4e67d987e8677ae1d41d0f15941b74cd4f779ac3061b9bbc59f51d5b9ecc0ff118ea9da82d18c23c369e
|
7
|
+
data.tar.gz: ec4021c84497bf407a7e44c6f9c19577b034ed76c8044d8e0494ece990f22a9384c8ae7b3c5f2183249c8c72c0726a0a1ad1d7c56c9a9eff741cebee4df87798
|
data/{README → README.md}
RENAMED
@@ -15,13 +15,10 @@ search for things in them later.
|
|
15
15
|
|
16
16
|
$ sudo gem install ferret
|
17
17
|
|
18
|
-
|
19
|
-
download one of the zipped up versions of Ferret, unzip it and change into the
|
20
|
-
unzipped directory. Then run the following set of commands;
|
18
|
+
Or to build it from this git repository:
|
21
19
|
|
22
|
-
$ ruby
|
23
|
-
$
|
24
|
-
$ sudo ruby setup.rb install
|
20
|
+
$ cd ruby
|
21
|
+
$ rake install
|
25
22
|
|
26
23
|
== Usage
|
27
24
|
|
data/Rakefile
CHANGED
@@ -83,7 +83,9 @@ namespace :build do
|
|
83
83
|
dest_fn = EXT_SRC_MAP[fn]
|
84
84
|
# prepend lib files to avoid conflicts
|
85
85
|
file dest_fn => fn do |t|
|
86
|
-
|
86
|
+
dest_path = File.expand_path(dest_fn)
|
87
|
+
rm_f dest_path
|
88
|
+
cp File.expand_path(fn), dest_path
|
87
89
|
|
88
90
|
if fn =~ /stemmer/
|
89
91
|
# flatten the directory structure for lib_stemmer
|
@@ -198,9 +200,9 @@ namespace :doc do
|
|
198
200
|
rdoc.options << '--inline-source'
|
199
201
|
rdoc.options << '--charset=utf-8'
|
200
202
|
# rdoc.template = allison_template if allison_template
|
201
|
-
rdoc.rdoc_files.include('README')
|
203
|
+
rdoc.rdoc_files.include('README.md')
|
202
204
|
rdoc.rdoc_files.include('TODO')
|
203
|
-
rdoc.rdoc_files.include('TUTORIAL')
|
205
|
+
rdoc.rdoc_files.include('TUTORIAL.md')
|
204
206
|
rdoc.rdoc_files.include('MIT-LICENSE')
|
205
207
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
206
208
|
rdoc.rdoc_files.include('ext/r_*.c')
|
@@ -218,7 +220,6 @@ end
|
|
218
220
|
##############################################################################
|
219
221
|
|
220
222
|
PKG_FILES = FileList[
|
221
|
-
'setup.rb',
|
222
223
|
'[-A-Z]*',
|
223
224
|
'lib/**/*.rb',
|
224
225
|
'lib/**/*.rhtml',
|
@@ -251,8 +252,7 @@ spec = Gem::Specification.new do |s|
|
|
251
252
|
#### Author and project details.
|
252
253
|
s.author = "David Balmain"
|
253
254
|
s.email = "dbalmain@gmail.com"
|
254
|
-
|
255
|
-
s.homepage = "http://github.com/jkraemer/ferret"
|
255
|
+
s.homepage = "http://github.com/dbalmain/ferret"
|
256
256
|
s.rubyforge_project = "ferret"
|
257
257
|
|
258
258
|
s.has_rdoc = true
|
@@ -297,7 +297,7 @@ task :uninstall => :clobber do
|
|
297
297
|
sh "#{SUDO}gem uninstall ferret"
|
298
298
|
end
|
299
299
|
|
300
|
-
desc "Same as :install but you must be
|
300
|
+
desc "Same as :install but you must be root"
|
301
301
|
task :root_install => :gem do
|
302
302
|
sh "gem install pkg/ferret-#{Ferret::VERSION}.gem --no-rdoc --no-ri -l"
|
303
303
|
end
|
data/{TUTORIAL → TUTORIAL.md}
RENAMED
File without changes
|
data/ext/BZLIB_blocksort.c
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
data/ext/BZLIB_bzlib.c
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
@@ -31,7 +31,6 @@
|
|
31
31
|
#include "bzlib_private.h"
|
32
32
|
|
33
33
|
|
34
|
-
|
35
34
|
/*---------------------------------------------------*/
|
36
35
|
/*--- Compression stuff ---*/
|
37
36
|
/*---------------------------------------------------*/
|
@@ -49,7 +48,7 @@ void BZ2_bz__AssertH__fail ( int errcode )
|
|
49
48
|
"component, you should also report this bug to the author(s)\n"
|
50
49
|
"of that program. Please make an effort to report this bug;\n"
|
51
50
|
"timely and accurate bug reports eventually lead to higher\n"
|
52
|
-
"quality software. Thanks. Julian Seward,
|
51
|
+
"quality software. Thanks. Julian Seward, 10 December 2007.\n\n",
|
53
52
|
errcode,
|
54
53
|
BZ2_bzlibVersion()
|
55
54
|
);
|
@@ -84,9 +83,6 @@ void BZ2_bz__AssertH__fail ( int errcode )
|
|
84
83
|
|
85
84
|
exit(3);
|
86
85
|
}
|
87
|
-
#else
|
88
|
-
void BZ2_bz__AssertH__fail ( int errcode ) { (void)errcode; }
|
89
|
-
void bz_internal_error ( int errcode ) { (void)errcode; }
|
90
86
|
#endif
|
91
87
|
|
92
88
|
|
@@ -106,7 +102,6 @@ static
|
|
106
102
|
void* default_bzalloc ( void* opaque, Int32 items, Int32 size )
|
107
103
|
{
|
108
104
|
void* v = malloc ( items * size );
|
109
|
-
(void)opaque; /* Ferret modification to remove compile warning */
|
110
105
|
return v;
|
111
106
|
}
|
112
107
|
|
@@ -114,7 +109,6 @@ static
|
|
114
109
|
void default_bzfree ( void* opaque, void* addr )
|
115
110
|
{
|
116
111
|
if (addr != NULL) free ( addr );
|
117
|
-
(void)opaque; /* Ferret modification to remove compile warning */
|
118
112
|
}
|
119
113
|
|
120
114
|
|
@@ -604,6 +598,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
|
|
604
598
|
UInt32 c_tPos = s->tPos;
|
605
599
|
char* cs_next_out = s->strm->next_out;
|
606
600
|
unsigned int cs_avail_out = s->strm->avail_out;
|
601
|
+
Int32 ro_blockSize100k = s->blockSize100k;
|
607
602
|
/* end restore */
|
608
603
|
|
609
604
|
UInt32 avail_out_INIT = cs_avail_out;
|
@@ -1511,7 +1506,6 @@ int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len )
|
|
1511
1506
|
int BZ_API(BZ2_bzflush) (BZFILE *b)
|
1512
1507
|
{
|
1513
1508
|
/* do nothing now... */
|
1514
|
-
(void)b; /* Ferret modification to remove compile warning */
|
1515
1509
|
return 0;
|
1516
1510
|
}
|
1517
1511
|
|
data/ext/BZLIB_compress.c
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
data/ext/BZLIB_crctable.c
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
data/ext/BZLIB_decompress.c
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
@@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s )
|
|
381
381
|
es = -1;
|
382
382
|
N = 1;
|
383
383
|
do {
|
384
|
+
/* Check that N doesn't get too big, so that es doesn't
|
385
|
+
go negative. The maximum value that can be
|
386
|
+
RUNA/RUNB encoded is equal to the block size (post
|
387
|
+
the initial RLE), viz, 900k, so bounding N at 2
|
388
|
+
million should guard against overflow without
|
389
|
+
rejecting any legitimate inputs. */
|
390
|
+
if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR);
|
384
391
|
if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
|
385
392
|
if (nextSym == BZ_RUNB) es = es + (1+1) * N;
|
386
393
|
N = N * 2;
|
@@ -485,15 +492,28 @@ Int32 BZ2_decompress ( DState* s )
|
|
485
492
|
RETURN(BZ_DATA_ERROR);
|
486
493
|
|
487
494
|
/*-- Set up cftab to facilitate generation of T^(-1) --*/
|
495
|
+
/* Check: unzftab entries in range. */
|
496
|
+
for (i = 0; i <= 255; i++) {
|
497
|
+
if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)
|
498
|
+
RETURN(BZ_DATA_ERROR);
|
499
|
+
}
|
500
|
+
/* Actually generate cftab. */
|
488
501
|
s->cftab[0] = 0;
|
489
502
|
for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
|
490
503
|
for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
|
504
|
+
/* Check: cftab entries in range. */
|
491
505
|
for (i = 0; i <= 256; i++) {
|
492
506
|
if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
|
493
507
|
/* s->cftab[i] can legitimately be == nblock */
|
494
508
|
RETURN(BZ_DATA_ERROR);
|
495
509
|
}
|
496
510
|
}
|
511
|
+
/* Check: cftab entries non-descending. */
|
512
|
+
for (i = 1; i <= 256; i++) {
|
513
|
+
if (s->cftab[i-1] > s->cftab[i]) {
|
514
|
+
RETURN(BZ_DATA_ERROR);
|
515
|
+
}
|
516
|
+
}
|
497
517
|
|
498
518
|
s->state_out_len = 0;
|
499
519
|
s->state_out_ch = 0;
|
data/ext/BZLIB_huffman.c
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
data/ext/BZLIB_randtable.c
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
data/ext/bitvector.c
CHANGED
@@ -43,6 +43,8 @@ void bv_scan_reset(BitVector *bv)
|
|
43
43
|
|
44
44
|
int bv_eq(BitVector *bv1, BitVector *bv2)
|
45
45
|
{
|
46
|
+
u32 *bits, *bits2;
|
47
|
+
int min_size, word_size, ext_word_size = 0, i;
|
46
48
|
if (bv1 == bv2) {
|
47
49
|
return true;
|
48
50
|
}
|
@@ -51,12 +53,10 @@ int bv_eq(BitVector *bv1, BitVector *bv2)
|
|
51
53
|
return false;
|
52
54
|
}
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
int ext_word_size = 0;
|
59
|
-
int i;
|
56
|
+
bits = bv1->bits;
|
57
|
+
bits2 = bv2->bits;
|
58
|
+
min_size = min2(bv1->size, bv2->size);
|
59
|
+
word_size = TO_WORD(min_size);
|
60
60
|
|
61
61
|
for (i = 0; i < word_size; i++) {
|
62
62
|
if (bits[i] != bits2[i]) {
|
data/ext/bzlib.h
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
data/ext/bzlib_private.h
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
This file is part of bzip2/libbzip2, a program and library for
|
9
9
|
lossless, block-sorting data compression.
|
10
10
|
|
11
|
-
bzip2/libbzip2 version 1.0.
|
12
|
-
Copyright (C) 1996-
|
11
|
+
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
12
|
+
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
13
13
|
|
14
14
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
15
15
|
README file.
|
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
/*-- General stuff. --*/
|
38
38
|
|
39
|
-
#define BZ_VERSION "1.0.
|
39
|
+
#define BZ_VERSION "1.0.6, 6-Sept-2010"
|
40
40
|
|
41
41
|
typedef char Char;
|
42
42
|
typedef unsigned char Bool;
|
@@ -442,11 +442,15 @@ typedef
|
|
442
442
|
/*-- Macros for decompression. --*/
|
443
443
|
|
444
444
|
#define BZ_GET_FAST(cccc) \
|
445
|
+
/* c_tPos is unsigned, hence test < 0 is pointless. */ \
|
446
|
+
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
|
445
447
|
s->tPos = s->tt[s->tPos]; \
|
446
448
|
cccc = (UChar)(s->tPos & 0xff); \
|
447
449
|
s->tPos >>= 8;
|
448
450
|
|
449
451
|
#define BZ_GET_FAST_C(cccc) \
|
452
|
+
/* c_tPos is unsigned, hence test < 0 is pointless. */ \
|
453
|
+
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \
|
450
454
|
c_tPos = c_tt[c_tPos]; \
|
451
455
|
cccc = (UChar)(c_tPos & 0xff); \
|
452
456
|
c_tPos >>= 8;
|
@@ -469,8 +473,10 @@ typedef
|
|
469
473
|
(((UInt32)s->ll16[i]) | (GET_LL4(i) << 16))
|
470
474
|
|
471
475
|
#define BZ_GET_SMALL(cccc) \
|
472
|
-
|
473
|
-
|
476
|
+
/* c_tPos is unsigned, hence test < 0 is pointless. */ \
|
477
|
+
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
|
478
|
+
cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \
|
479
|
+
s->tPos = GET_LL(s->tPos);
|
474
480
|
|
475
481
|
|
476
482
|
/*-- externs for decompression. --*/
|
data/ext/compound_io.c
CHANGED
@@ -215,7 +215,7 @@ Store *open_cmpd_store(Store *store, const char *name)
|
|
215
215
|
int count, i;
|
216
216
|
off_t offset;
|
217
217
|
char *fname;
|
218
|
-
FileEntry *entry = NULL;
|
218
|
+
FileEntry *volatile entry = NULL;
|
219
219
|
Store *new_store = NULL;
|
220
220
|
CompoundStore *volatile cmpd = NULL;
|
221
221
|
InStream *volatile is = NULL;
|
data/ext/document.c
CHANGED
@@ -59,9 +59,6 @@ void df_destroy(DocField *df)
|
|
59
59
|
*/
|
60
60
|
char *df_to_s(DocField *df)
|
61
61
|
{
|
62
|
-
#define APPEND(dst, src) ((dst)[0] = (src)[0], 1)
|
63
|
-
#define APPEND2(dst, src) (APPEND(dst, src), APPEND(dst+1, src+1), 2)
|
64
|
-
|
65
62
|
int i, len = 0, namelen = sym_len(df->name);
|
66
63
|
char *str, *s;
|
67
64
|
for (i = 0; i < df->size; i++) {
|
@@ -70,23 +67,23 @@ char *df_to_s(DocField *df)
|
|
70
67
|
s = str = ALLOC_N(char, namelen + len + 5);
|
71
68
|
memcpy(s, df->name, namelen);
|
72
69
|
s += namelen;
|
73
|
-
s
|
70
|
+
s = strapp(s, ": ");
|
74
71
|
|
75
72
|
if (df->size > 1) {
|
76
|
-
s
|
73
|
+
s = strapp(s, "[");
|
77
74
|
}
|
78
75
|
for (i = 0; i < df->size; i++) {
|
79
76
|
if (i != 0) {
|
80
|
-
s
|
77
|
+
s = strapp(s, ", ");
|
81
78
|
}
|
82
|
-
s
|
79
|
+
s = strapp(s, "\"");
|
83
80
|
memcpy(s, df->data[i], df->lengths[i]);
|
84
81
|
s += df->lengths[i];
|
85
|
-
s
|
82
|
+
s = strapp(s, "\"");
|
86
83
|
}
|
87
84
|
|
88
85
|
if (df->size > 1) {
|
89
|
-
s
|
86
|
+
s = strapp(s, "]");
|
90
87
|
}
|
91
88
|
*s = 0;
|
92
89
|
return str;
|
data/ext/except.c
CHANGED
@@ -20,8 +20,8 @@ static const char *const ERROR_TYPES[] = {
|
|
20
20
|
"Lock Error"
|
21
21
|
};
|
22
22
|
|
23
|
-
char *const UNSUPPORTED_ERROR_MSG = "Unsupported operation";
|
24
|
-
char *const EOF_ERROR_MSG = "Read past end of file";
|
23
|
+
const char *const UNSUPPORTED_ERROR_MSG = "Unsupported operation";
|
24
|
+
const char *const EOF_ERROR_MSG = "Read past end of file";
|
25
25
|
char xmsg_buffer[XMSG_BUFFER_SIZE];
|
26
26
|
char xmsg_buffer_final[XMSG_BUFFER_SIZE];
|
27
27
|
|
data/ext/except.h
CHANGED
@@ -98,8 +98,8 @@ extern "C" {
|
|
98
98
|
#define FRT_INDEX_ERROR 11
|
99
99
|
#define FRT_LOCK_ERROR 12
|
100
100
|
|
101
|
-
extern char *const FRT_UNSUPPORTED_ERROR_MSG;
|
102
|
-
extern char *const FRT_EOF_ERROR_MSG;
|
101
|
+
extern const char *const FRT_UNSUPPORTED_ERROR_MSG;
|
102
|
+
extern const char *const FRT_EOF_ERROR_MSG;
|
103
103
|
|
104
104
|
typedef struct frt_xcontext_t
|
105
105
|
{
|
data/ext/field_index.c
CHANGED
@@ -234,7 +234,7 @@ static void string_handle_term(void *index_ptr,
|
|
234
234
|
StringIndex *index = (StringIndex *)index_ptr;
|
235
235
|
if (index->v_size >= index->v_capa) {
|
236
236
|
index->v_capa *= 2;
|
237
|
-
|
237
|
+
REALLOC_N(index->values, char *, index->v_capa);
|
238
238
|
}
|
239
239
|
index->values[index->v_size] = estrdup(text);
|
240
240
|
while (tde->next(tde)) {
|
data/ext/global.c
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
#include "hash.h"
|
4
4
|
#include <stdarg.h>
|
5
5
|
#include <stdio.h>
|
6
|
+
#include <stdlib.h>
|
6
7
|
#include <string.h>
|
7
8
|
#include <errno.h>
|
8
9
|
#include <assert.h>
|
@@ -45,7 +46,7 @@ int scmp(const void *p1, const void *p2)
|
|
45
46
|
return strcmp(*(char **) p1, *(char **) p2);
|
46
47
|
}
|
47
48
|
|
48
|
-
void
|
49
|
+
void strsort(char **str_array, int size)
|
49
50
|
{
|
50
51
|
qsort(str_array, size, sizeof(char *), &scmp);
|
51
52
|
}
|
@@ -165,6 +166,20 @@ char *dbl_to_s(char *buf, double num)
|
|
165
166
|
return buf;
|
166
167
|
}
|
167
168
|
|
169
|
+
/**
|
170
|
+
* strapp: appends a string up to, but not including the \0 character to the
|
171
|
+
* end of a string returning a pointer to the next unassigned character in the
|
172
|
+
* string.
|
173
|
+
*/
|
174
|
+
char *strapp(char *dst, const char *src) {
|
175
|
+
while (*src != '\0') {
|
176
|
+
*dst = *src;
|
177
|
+
++dst;
|
178
|
+
++src;
|
179
|
+
}
|
180
|
+
return dst;
|
181
|
+
}
|
182
|
+
|
168
183
|
/* strfmt: like sprintf except that it allocates memory for the string */
|
169
184
|
char *vstrfmt(const char *fmt, va_list args)
|
170
185
|
{
|
@@ -172,7 +187,7 @@ char *vstrfmt(const char *fmt, va_list args)
|
|
172
187
|
char *p = (char *) fmt, *q;
|
173
188
|
int len = (int) strlen(fmt) + 1;
|
174
189
|
int slen, curlen;
|
175
|
-
char *s;
|
190
|
+
const char *s;
|
176
191
|
long l;
|
177
192
|
double d;
|
178
193
|
|
@@ -248,36 +263,17 @@ void dummy_free(void *p)
|
|
248
263
|
#define CMD_BUF_SIZE (128 + FILENAME_MAX)
|
249
264
|
/* need to declare this as it is masked by default in linux */
|
250
265
|
|
251
|
-
static char *build_shell_command(
|
266
|
+
static char *build_shell_command()
|
252
267
|
{
|
253
268
|
int pid = getpid();
|
254
269
|
char *buf = ALLOC_N(char, CMD_BUF_SIZE);
|
255
270
|
char *command =
|
256
|
-
"gdb -quiet -
|
271
|
+
"gdb -quiet -ex='bt' -ex='quit' %s %d 2>/dev/null | grep '^[ #]'";
|
257
272
|
|
258
|
-
snprintf(buf, CMD_BUF_SIZE, command,
|
273
|
+
snprintf(buf, CMD_BUF_SIZE, command, progname(), pid);
|
259
274
|
return buf;
|
260
275
|
}
|
261
276
|
|
262
|
-
/* Returns the fd to the tempfile */
|
263
|
-
static int build_tempfile(char *name, size_t max_size)
|
264
|
-
{
|
265
|
-
char *tmpdir = getenv("TMPDIR");
|
266
|
-
|
267
|
-
snprintf(name, max_size, "%s/frt.XXXXXXXXXX", tmpdir ? tmpdir : "/tmp");
|
268
|
-
return mkstemp(name);
|
269
|
-
}
|
270
|
-
|
271
|
-
static char *build_gdb_commandfile()
|
272
|
-
{
|
273
|
-
const char *commands = "bt\nquit\n";
|
274
|
-
char *filename = ALLOC_N(char, FILENAME_MAX);
|
275
|
-
int fd = build_tempfile(filename, FILENAME_MAX);
|
276
|
-
if (fd < 0) { return NULL; }
|
277
|
-
write(fd, commands, strlen(commands));
|
278
|
-
close(fd);
|
279
|
-
return filename;
|
280
|
-
}
|
281
277
|
#endif
|
282
278
|
|
283
279
|
/**
|
@@ -290,12 +286,7 @@ char *get_stacktrace()
|
|
290
286
|
char *gdb_filename = NULL, *buf = NULL, *stack = NULL;
|
291
287
|
int offset = -BUFFER_SIZE;
|
292
288
|
|
293
|
-
if ( !(
|
294
|
-
fprintf(EXCEPTION_STREAM,
|
295
|
-
"Unable to build gdb command file\n");
|
296
|
-
goto cleanup;
|
297
|
-
}
|
298
|
-
if ( !(buf = build_shell_command(gdb_filename)) ) {
|
289
|
+
if ( !(buf = build_shell_command()) ) {
|
299
290
|
fprintf(EXCEPTION_STREAM,
|
300
291
|
"Unable to build stacktrace shell command\n");
|
301
292
|
goto cleanup;
|