ffi-hunspell 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -5
- data/ChangeLog.md +10 -0
- data/LICENSE.txt +1 -1
- data/README.md +16 -3
- data/ffi-hunspell.gemspec +1 -0
- data/gemspec.yml +6 -0
- data/lib/ffi/hunspell/dictionary.rb +13 -5
- data/lib/ffi/hunspell/version.rb +1 -1
- data/spec/dictionary_spec.rb +2 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73c2a507e6fe1a6f34ff4a97f4db79c0518f5d352386c82cc69e6c35bfbe075a
|
4
|
+
data.tar.gz: dd5c8a8190a2cfa273f07a84fafea7c3422e1a3a4cdd4b6a1d629c465ced350e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db867a438a0c6546d3175bf086ec999f905f27bbe663cc3a8758fd43516bb1968843f16800f6bf2f2322356005fd84e7c5915e2a964abb1b6cd8d7ce57f82d2b
|
7
|
+
data.tar.gz: 1af4a53d595bf279a43db1e1a3c5d8cdbe5439ef8853f4e829cc7b38115e1632a770c41af401645f427e5b85f7449257edc00f8434e205eee488d5c45cde7908
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
name: CI
|
2
2
|
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master ]
|
6
|
-
pull_request:
|
7
|
-
branches: ['**']
|
3
|
+
on: [ push, pull_request ]
|
8
4
|
|
9
5
|
jobs:
|
10
6
|
tests:
|
@@ -17,6 +13,7 @@ jobs:
|
|
17
13
|
- 2.5
|
18
14
|
- 2.6
|
19
15
|
- 2.7
|
16
|
+
- 3.0
|
20
17
|
- jruby
|
21
18
|
name: Ruby ${{ matrix.ruby }}
|
22
19
|
steps:
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
### 0.6.1 / 2021-02-12
|
2
|
+
|
3
|
+
* Fixed a possible memory leak in {FFI::Hunspell::Dictionary#stem} and
|
4
|
+
{FFI::Hunspell::Dictionary#suggest}.
|
5
|
+
* Prevent a possible memory leak if {FFI::Hunspell::Dictionary#close} is not
|
6
|
+
called, which deallocates the underlying libhunspell handler pointer,
|
7
|
+
before the dictionary is garbage collected. Note: if
|
8
|
+
{FFI::Hunspell::Dictionary.open} is called with a block, the dictionary object
|
9
|
+
will explicitly be closed once the block returns.
|
10
|
+
|
1
11
|
### 0.6.0 / 2020-11-28
|
2
12
|
|
3
13
|
* Added {FFI::Hunspell::Dictionary#add_dic} which adds an extra dictionary
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
* [Source](https://github.com/postmodern/ffi-hunspell)
|
4
4
|
* [Issues](https://github.com/postmodern/ffi-hunspell/issues)
|
5
5
|
* [Documentation](http://rubydoc.info/gems/ffi-hunspell/frames)
|
6
|
-
* [Email](postmodern.mod3 at gmail.com)
|
7
6
|
|
8
7
|
## Description
|
9
8
|
|
@@ -64,11 +63,25 @@ dict.suggest('arbitrage')
|
|
64
63
|
$ gem install ffi-hunspell
|
65
64
|
```
|
66
65
|
|
66
|
+
### libhunspell
|
67
|
+
|
68
|
+
* Debian / Ubuntu:
|
69
|
+
|
70
|
+
$ sudo apt install libhunspell-dev hunspell-en-us
|
71
|
+
|
72
|
+
* RedHat / Fedora:
|
73
|
+
|
74
|
+
$ sudo dnf install hunspell-devel hunspell-en
|
75
|
+
|
76
|
+
* macOS:
|
77
|
+
|
78
|
+
$ brew install hunspell
|
79
|
+
|
67
80
|
## License
|
68
81
|
|
69
|
-
Copyright (c) 2010-
|
82
|
+
Copyright (c) 2010-2021 Hal Brodigan
|
70
83
|
|
71
84
|
See {file:LICENSE.txt} for license information.
|
72
85
|
|
73
86
|
[libhunspell]: http://hunspell.github.io/
|
74
|
-
[ffi]: https://github.com/ffi/ffi
|
87
|
+
[ffi]: https://github.com/ffi/ffi#readme
|
data/ffi-hunspell.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.authors = Array(gemspec['authors'])
|
21
21
|
gem.email = gemspec['email']
|
22
22
|
gem.homepage = gemspec['homepage']
|
23
|
+
gem.metadata = gemspec['metadata'] if gemspec['metadata']
|
23
24
|
|
24
25
|
glob = lambda { |patterns| gem.files & Dir[*patterns] }
|
25
26
|
|
data/gemspec.yml
CHANGED
@@ -7,6 +7,12 @@ email: postmodern.mod3@gmail.com
|
|
7
7
|
homepage: https://github.com/postmodern/ffi-hunspell#readme
|
8
8
|
has_yard: true
|
9
9
|
|
10
|
+
metadata:
|
11
|
+
documentation_uri: https://rubydoc.info/gems/ffi-hunspell
|
12
|
+
source_code_uri: https://github.com/postmodern/ffi-hunspell
|
13
|
+
bug_tracker_uri: https://github.com/postmodern/ffi-hunspell/issues
|
14
|
+
changelog_uri: https://github.com/postmodern/ffi-hunspell/blob/master/ChangeLog.md
|
15
|
+
|
10
16
|
requirements: libhunspell >= 1.2.0, <= 1.7.0
|
11
17
|
|
12
18
|
required_ruby_version: ">= 1.9.1"
|
@@ -37,9 +37,11 @@ module FFI
|
|
37
37
|
raise("invalid dic path #{dic_path.inspect}")
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
ptr = if key then Hunspell.Hunspell_create_key(affix_path,dic_path,key)
|
41
|
+
else Hunspell.Hunspell_create(affix_path,dic_path)
|
42
|
+
end
|
43
|
+
|
44
|
+
@ptr = FFI::AutoPointer.new(ptr,Hunspell.method(:Hunspell_destroy))
|
43
45
|
end
|
44
46
|
|
45
47
|
#
|
@@ -207,6 +209,8 @@ module FFI
|
|
207
209
|
|
208
210
|
if count > 0
|
209
211
|
stems = ptr.get_array_of_string(0,count)
|
212
|
+
|
213
|
+
Hunspell.Hunspell_free_list(self,output,count)
|
210
214
|
end
|
211
215
|
end
|
212
216
|
|
@@ -231,6 +235,8 @@ module FFI
|
|
231
235
|
|
232
236
|
if count > 0
|
233
237
|
suggestions = ptr.get_array_of_string(0,count)
|
238
|
+
|
239
|
+
Hunspell.Hunspell_free_list(self,output,count)
|
234
240
|
end
|
235
241
|
end
|
236
242
|
|
@@ -243,9 +249,11 @@ module FFI
|
|
243
249
|
# @return [nil]
|
244
250
|
#
|
245
251
|
def close
|
246
|
-
|
252
|
+
if @ptr
|
253
|
+
@ptr.free
|
254
|
+
@ptr = nil
|
255
|
+
end
|
247
256
|
|
248
|
-
@ptr = nil
|
249
257
|
return nil
|
250
258
|
end
|
251
259
|
|
data/lib/ffi/hunspell/version.rb
CHANGED
data/spec/dictionary_spec.rb
CHANGED
@@ -58,7 +58,8 @@ describe Hunspell::Dictionary do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
describe "#add_dic" do
|
61
|
-
let(:
|
61
|
+
let(:fixtures_dir) { File.expand_path('../fixtures',__FILE__) }
|
62
|
+
let(:extra_dic) { File.join(fixtures_dir,'extra.dic') }
|
62
63
|
|
63
64
|
if FFI::Hunspell.respond_to?(:Hunspell_add_dic)
|
64
65
|
context "when libhunspell supports add_dic" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-hunspell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -70,7 +70,11 @@ files:
|
|
70
70
|
homepage: https://github.com/postmodern/ffi-hunspell#readme
|
71
71
|
licenses:
|
72
72
|
- MIT
|
73
|
-
metadata:
|
73
|
+
metadata:
|
74
|
+
documentation_uri: https://rubydoc.info/gems/ffi-hunspell
|
75
|
+
source_code_uri: https://github.com/postmodern/ffi-hunspell
|
76
|
+
bug_tracker_uri: https://github.com/postmodern/ffi-hunspell/issues
|
77
|
+
changelog_uri: https://github.com/postmodern/ffi-hunspell/blob/master/ChangeLog.md
|
74
78
|
post_install_message:
|
75
79
|
rdoc_options: []
|
76
80
|
require_paths:
|