Skip to content

Set dependencies with ~> to prevent major verion breakage #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- rbx
- 2.0.0
- 2.1.2
- rbx-2
- ree
- ruby-head
- rbx-18mode
- rbx-19mode
matrix:
allow_failures:
- rvm: rbx-18mode
- rvm: rbx-19mode
- rvm: rbx-2
script:
- bundle exec rake
- bundle exec rspec
5 changes: 3 additions & 2 deletions bzip2-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files spec`.split("\n")

# tests
s.add_development_dependency 'rake-compiler', ">= 0.7.5"
s.add_development_dependency 'rspec', ">= 2.0.0"
s.add_development_dependency 'rake-compiler', '~> 0.8.0'
s.add_development_dependency 'rake', '~> 0.9.3'
s.add_development_dependency 'rspec', '~> 2.8.0'
end
2 changes: 1 addition & 1 deletion ext/bzip2/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void bz_free(void *opaque, void *p) {
free(p);
}

VALUE bz_raise(int error) {
void bz_raise(int error) {
VALUE exc;
const char *msg;

Expand Down
18 changes: 1 addition & 17 deletions ext/bzip2/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@
#define DEFAULT_BLOCKS 9
#define ASIZE (1 << CHAR_BIT)

/* Older versions of Ruby (< 1.8.6) need these */
#ifndef RSTRING_PTR
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
#endif
#ifndef RSTRING_LEN
# define RSTRING_LEN(s) (RSTRING(s)->len)
#endif
#ifndef RARRAY_PTR
# define RARRAY_PTR(s) (RARRAY(s)->ptr)
#endif
#ifndef RARRAY_LEN
# define RARRAY_LEN(s) (RARRAY(s)->len)
#endif

struct bz_file {
bz_stream bzs;
VALUE in, io;
Expand All @@ -58,19 +44,17 @@ struct bz_iv {
rb_raise(rb_eIOError, "closed IO"); \
}

#ifndef ASDFasdf
extern VALUE bz_cWriter, bz_cReader, bz_cInternal;
extern VALUE bz_eError, bz_eEOZError;

extern VALUE bz_internal_ary;

extern ID id_new, id_write, id_open, id_flush, id_read;
extern ID id_closed, id_close, id_str;
#endif

void bz_file_mark(struct bz_file * bzf);
void* bz_malloc(void *opaque, int m, int n);
void bz_free(void *opaque, void *p);
VALUE bz_raise(int err);
void bz_raise(int err);

#endif
11 changes: 4 additions & 7 deletions ext/bzip2/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ VALUE bz_reader_read(int argc, VALUE *argv, VALUE obj) {
OBJ_TAINT(res);
}
if (n == 0) {
free(bzf->buf);
return res;
}
while (1) {
Expand All @@ -326,14 +325,12 @@ VALUE bz_reader_read(int argc, VALUE *argv, VALUE obj) {
res = rb_str_cat(res, bzf->bzs.next_out, n);
bzf->bzs.next_out += n;
bzf->bzs.avail_out -= n;
free(bzf->buf);
return res;
}
if (total) {
res = rb_str_cat(res, bzf->bzs.next_out, total);
}
if (bz_next_available(bzf, 0) == BZ_STREAM_END) {
free(bzf->buf);
return res;
}
}
Expand Down Expand Up @@ -802,8 +799,8 @@ VALUE bz_reader_close(VALUE obj) {

Get_BZ2(obj, bzf);
if (bzf->buf) {
free(bzf->buf);
bzf->buf = 0;
xfree(bzf->buf);
bzf->buf = NULL;
}
if (bzf->state == BZ_OK) {
BZ2_bzDecompressEnd(&(bzf->bzs));
Expand Down Expand Up @@ -837,9 +834,9 @@ VALUE bz_reader_finish(VALUE obj) {
Get_BZ2(obj, bzf);
if (bzf->buf) {
rb_funcall2(obj, id_read, 0, 0);
free(bzf->buf);
xfree(bzf->buf);
bzf->buf = NULL;
}
bzf->buf = 0;
bzf->state = BZ_OK;
return Qnil;
}
Expand Down