talkfilters 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@ if have_library("talkfilters", "gtf_filter_lookup") and
5
5
  have_library("talkfilters", "gtf_filter_list") and
6
6
  have_library("talkfilters", "gtf_filter_count") and
7
7
  have_header("talkfilters.h")
8
+ dir_config("talkfilters")
8
9
  create_makefile("talkfilters")
9
10
  else
10
11
  rm_f "Makefile"
@@ -35,15 +35,20 @@ VALUE tf_translate(VALUE dummy, VALUE type, VALUE string) {
35
35
 
36
36
  filter = (gtf_filter_t *) gtf_filter_lookup(RSTRING(type)->ptr);
37
37
 
38
- while (filter->filter(RSTRING(string)->ptr, buf, bufsize)) {
39
- tmpbuf = realloc(buf, bufsize + TF_REALLOC_SIZE);
40
- if (tmpbuf == NULL) {
41
- rb_raise(rb_eException, "Allocation Error");
42
- return rb_str_new2("");
43
- } else {
44
- buf = tmpbuf;
45
- bufsize += TF_REALLOC_SIZE;
38
+ if (filter != NULL) {
39
+ while (filter->filter(RSTRING(string)->ptr, buf, bufsize)) {
40
+ tmpbuf = realloc(buf, bufsize + TF_REALLOC_SIZE);
41
+ if (tmpbuf == NULL) {
42
+ rb_raise(rb_eException, "Allocation Error");
43
+ return rb_str_new2("");
44
+ } else {
45
+ buf = tmpbuf;
46
+ bufsize += TF_REALLOC_SIZE;
47
+ }
46
48
  }
49
+ } else {
50
+ rb_raise(rb_eException, "Could not locate filter");
51
+ return rb_str_new2("");
47
52
  }
48
53
 
49
54
  return rb_str_new2(buf);
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: talkfilters
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2007-05-13 00:00:00 -07:00
6
+ version: 0.0.3
7
+ date: 2007-05-20 00:00:00 -07:00
8
8
  summary: Ruby interface to GNU Talkfilters
9
9
  require_paths:
10
10
  - lib