ruby-rpm 1.2.4 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,10 @@
1
+ 2010-08-19 Duncan Mac-Vicar P. <dmacvicar@suse.de>
2
+
3
+ * build system cleanup
4
+ * use rake-compiler to build extension
5
+ * bundler (>= 1.0pre) & Gemfile support
6
+ * ruby 1.9 support
7
+
1
8
  2009-10-20 Duncan Mac-Vicar P. <dmacvicar@suse.de>
2
9
 
3
10
  * port to rpm 4.7. Still should work with older versions
@@ -0,0 +1,40 @@
1
+ = RPM bindings for ruby
2
+
3
+ * http://www.gitorious.org/ruby-rpm
4
+
5
+ == Introduction
6
+
7
+ Ruby/RPM is an interface to access RPM database for Ruby.
8
+
9
+ == Requirements
10
+
11
+ * ruby 1.8+
12
+ * gcc
13
+ * rpm 4.0.0 or newer (tested on 4.0.4 and 4.2.1)
14
+
15
+ == Installation
16
+
17
+ * gem install rpm
18
+
19
+ == Building
20
+
21
+ If you want to automatically install required gems, make sure to
22
+ have bundler 1.x installed
23
+
24
+ * gem instal bundler
25
+ * gem build rpm.gemspec
26
+
27
+ == Usage
28
+
29
+ require 'rpm'
30
+
31
+ == License
32
+
33
+ GPLv2. See COPYING file.
34
+
35
+ == Credits
36
+
37
+ * Kenta MURATA <muraken@kondara.org>
38
+ * David Lutterkort <dlutter@redhat.com>
39
+ * Duncan Mac-Vicar P. <dmacvicar@suse.de>
40
+
@@ -71,7 +71,7 @@ db_s_open(int argc, VALUE* argv, VALUE obj)
71
71
  if (TYPE(argv[1]) != T_STRING) {
72
72
  rb_raise(rb_eTypeError, "illegal argument type");
73
73
  }
74
- root = RSTRING(argv[1])->ptr;
74
+ root = RSTRING_PTR(argv[1]);
75
75
  }
76
76
  writable = RTEST(argv[0]);
77
77
  break;
@@ -85,8 +85,8 @@ db_s_open(int argc, VALUE* argv, VALUE obj)
85
85
  if (rpmdbOpen(root, &(rdb->db), writable ? O_RDWR | O_CREAT : O_RDONLY, 0644)) {
86
86
  free(rdb);
87
87
  rb_raise(rb_eRuntimeError, "can not open database in %s",
88
- RSTRING(rb_str_concat(rb_str_new2(root),
89
- rb_str_new2("/var/lib/rpm")))->ptr);
88
+ RSTRING_PTR(rb_str_concat(rb_str_new2(root),
89
+ rb_str_new2("/var/lib/rpm"))));
90
90
  }
91
91
 
92
92
  rdb->ref_count = 0;
@@ -121,7 +121,7 @@ db_s_init(int argc, VALUE* argv, VALUE obj)
121
121
  if (TYPE(argv[0]) != T_STRING) {
122
122
  rb_raise(rb_eTypeError, "illegal argument type");
123
123
  }
124
- root = RSTRING(argv[0])->ptr;
124
+ root = RSTRING_PTR(argv[0]);
125
125
  if (argc == 2) {
126
126
  writable = RTEST(argv[1]);
127
127
  }
@@ -133,8 +133,8 @@ db_s_init(int argc, VALUE* argv, VALUE obj)
133
133
 
134
134
  if (rpmdbInit(root, writable ? O_RDWR | O_CREAT : O_RDONLY)) {
135
135
  rb_raise(rb_eRuntimeError, "can not initialize database in %s",
136
- RSTRING(rb_str_concat(rb_str_new2(root),
137
- rb_str_new2("/var/lib/rpm")))->ptr);
136
+ RSTRING_PTR(rb_str_concat(rb_str_new2(root),
137
+ rb_str_new2("/var/lib/rpm"))));
138
138
  }
139
139
 
140
140
  return Qnil;
@@ -164,7 +164,7 @@ db_s_rebuild(int argc, VALUE* argv, VALUE obj)
164
164
  if (TYPE(argv[0]) != T_STRING) {
165
165
  rb_raise(rb_eTypeError, "illegal argument type");
166
166
  }
167
- root = RSTRING(argv[0])->ptr;
167
+ root = RSTRING_PTR(argv[0]);
168
168
  }
169
169
  break;
170
170
 
@@ -180,8 +180,8 @@ db_s_rebuild(int argc, VALUE* argv, VALUE obj)
180
180
  #endif
181
181
  if (ret) {
182
182
  rb_raise(rb_eRuntimeError, "can not rebuild database in %s",
183
- RSTRING(rb_str_concat(rb_str_new2(root),
184
- rb_str_new2("/var/lib/rpm")))->ptr);
183
+ RSTRING_PTR(rb_str_concat(rb_str_new2(root),
184
+ rb_str_new2("/var/lib/rpm"))));
185
185
  }
186
186
 
187
187
  return Qnil;
@@ -311,7 +311,7 @@ rpm_db_transaction(int argc, VALUE* argv, VALUE db)
311
311
  if (TYPE(argv[0]) != T_STRING) {
312
312
  rb_raise(rb_eTypeError, "illegal argument type");
313
313
  }
314
- root = RSTRING(argv[0])->ptr;
314
+ root = RSTRING_PTR(argv[0]);
315
315
  break;
316
316
 
317
317
  default:
@@ -393,10 +393,10 @@ rpm_transaction_install(VALUE trans, VALUE pkg, VALUE key)
393
393
 
394
394
  #if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
395
395
  rpmtransAddPackage(RPM_TRANSACTION(trans), RPM_HEADER(pkg), NULL,
396
- RSTRING(key)->ptr, 0, NULL);
396
+ RSTRING_PTR(key), 0, NULL);
397
397
  #else
398
398
  rpmtsAddInstallElement(RPM_TRANSACTION(trans), RPM_HEADER(pkg),
399
- RSTRING(key)->ptr, 0, NULL);
399
+ RSTRING_PTR(key), 0, NULL);
400
400
  #endif
401
401
 
402
402
  return Qnil;
@@ -423,10 +423,10 @@ rpm_transaction_upgrade(VALUE trans, VALUE pkg, VALUE key)
423
423
  rb_ary_push(keys, key);
424
424
  #if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
425
425
  rpmtransAddPackage(RPM_TRANSACTION(trans), RPM_HEADER(pkg), NULL,
426
- RSTRING(key)->ptr, 1, NULL);
426
+ RSTRING_PTR(key), 1, NULL);
427
427
  #else
428
428
  rpmtsAddInstallElement(RPM_TRANSACTION(trans), RPM_HEADER(pkg),
429
- RSTRING(key)->ptr, 1, NULL);
429
+ RSTRING_PTR(key), 1, NULL);
430
430
  #endif
431
431
 
432
432
  return Qnil;
@@ -455,7 +455,7 @@ rpm_transaction_available(VALUE trans, VALUE pkg, VALUE key)
455
455
 
456
456
  #if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
457
457
  rpmtransAvailablePackage(RPM_TRANSACTION(trans), RPM_HEADER(pkg),
458
- RSTRING(key)->ptr);
458
+ RSTRING_PTR(key));
459
459
  #else
460
460
  rb_raise(rb_eNotImpError, "need rpmtsAvailablePackage");
461
461
  // FIXME: What is the analog for rpmtsAvailablePackage
@@ -571,7 +571,7 @@ package_new_from_NEVR(const char* nevr)
571
571
  {
572
572
  char *name = NULL;
573
573
  char *evr = NULL;
574
- char *end = NULL;
574
+ char *end = NULL;
575
575
  char *tmp_nevr = NULL;
576
576
  VALUE package = Qnil;
577
577
  int i=0;
@@ -591,11 +591,11 @@ package_new_from_NEVR(const char* nevr)
591
591
  if ( i==2 ) {
592
592
  *end = '\0'; evr = end + 1;
593
593
  } else {
594
- evr = "";
594
+ evr = NULL;
595
595
  }
596
596
 
597
597
  package = rpm_package_new_from_N_EVR(rb_str_new2(name),
598
- version_new_from_EVR(evr));
598
+ version_new_from_EVR(evr ? evr : ""));
599
599
  free(tmp_nevr);
600
600
  return package;
601
601
  }
@@ -667,7 +667,7 @@ rpm_transaction_check(VALUE trans)
667
667
 
668
668
  char *name = buf+2;
669
669
  char *relation = NULL;
670
- char *evr = "";
670
+ char *evr = NULL;
671
671
  rpmsenseFlags sense_flags = 0;
672
672
 
673
673
  end = strchr ( name, ' ');
@@ -691,7 +691,7 @@ rpm_transaction_check(VALUE trans)
691
691
  }
692
692
 
693
693
  dep = rpm_require_new(name,
694
- rpm_version_new(evr),
694
+ rpm_version_new(evr ? evr : ""),
695
695
  sense_flags,
696
696
  package_new_from_NEVR(
697
697
  rpmProblemGetPkgNEVR(p)
@@ -1049,8 +1049,8 @@ rpm_db_init_iterator(VALUE db, VALUE key, VALUE val)
1049
1049
 
1050
1050
  mi = ALLOC_N(rpm_mi_t,1);
1051
1051
  if ((mi->mi = rpmdbInitIterator(RPM_DB(db), NUM2INT(rb_Integer(key)),
1052
- NIL_P(val) ? NULL : RSTRING(val)->ptr,
1053
- NIL_P(val) ? 0 : RSTRING(val)->len))){
1052
+ NIL_P(val) ? NULL : RSTRING_PTR(val),
1053
+ NIL_P(val) ? 0 : RSTRING_LEN(val)))){
1054
1054
  mi->db = (rpm_db_t*)DATA_PTR(db);
1055
1055
  db_ref(mi->db);
1056
1056
  return Data_Wrap_Struct(rpm_cMatchIterator, NULL, mi_free, mi);
@@ -1092,7 +1092,7 @@ rpm_mi_set_iterator_re(VALUE mi,VALUE tag, VALUE mode, VALUE re)
1092
1092
  if (TYPE(re) != T_STRING)
1093
1093
  rb_raise(rb_eTypeError, "illegal argument type");
1094
1094
 
1095
- rpmdbSetIteratorRE(RPM_MI(mi),NUM2INT(tag),NUM2INT(mode),RSTRING(re)->ptr);
1095
+ rpmdbSetIteratorRE(RPM_MI(mi),NUM2INT(tag),NUM2INT(mode),RSTRING_PTR(re));
1096
1096
  return mi;
1097
1097
  }
1098
1098
 
@@ -1104,16 +1104,16 @@ rpm_mi_set_iterator_version(VALUE mi, VALUE version)
1104
1104
  if (rb_obj_is_kind_of(version, rpm_cVersion) == Qfalse)
1105
1105
  rb_raise(rb_eTypeError, "illegal argument type");
1106
1106
  #if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
1107
- rpmdbSetIteratorVersion(RPM_MI(mi),RSTRING(rpm_version_get_v(version))->ptr);
1107
+ rpmdbSetIteratorVersion(RPM_MI(mi),RSTRING_PTR(rpm_version_get_v(version)));
1108
1108
  #else
1109
- rpmdbSetIteratorRE(RPM_MI(mi),RPMTAG_VERSION,RPMMIRE_DEFAULT,RSTRING(rpm_version_get_v(version))->ptr);
1109
+ rpmdbSetIteratorRE(RPM_MI(mi),RPMTAG_VERSION,RPMMIRE_DEFAULT,RSTRING_PTR(rpm_version_get_v(version)));
1110
1110
  #endif
1111
1111
  r = rpm_version_get_r(version);
1112
1112
  if(!NIL_P(r)){
1113
1113
  #if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
1114
- rpmdbSetIteratorRelease(RPM_MI(mi),RSTRING(r)->ptr);
1114
+ rpmdbSetIteratorRelease(RPM_MI(mi),RSTRING_PTR(r));
1115
1115
  #else
1116
- rpmdbSetIteratorRE(RPM_MI(mi),RPMTAG_RELEASE,RPMMIRE_DEFAULT,RSTRING(r)->ptr);
1116
+ rpmdbSetIteratorRE(RPM_MI(mi),RPMTAG_RELEASE,RPMMIRE_DEFAULT,RSTRING_PTR(r));
1117
1117
  #endif
1118
1118
  }
1119
1119
  return mi;
@@ -179,17 +179,17 @@ rpm_dependency_is_satisfy(VALUE dep,VALUE other)
179
179
  return Qfalse;
180
180
  }
181
181
 
182
- name = RSTRING(rb_ivar_get(dep,id_name))->ptr;
183
- svre = RSTRING(rpm_version_to_vre(rb_ivar_get(dep,id_ver)))->ptr;
182
+ name = RSTRING_PTR(rb_ivar_get(dep,id_name));
183
+ svre = RSTRING_PTR(rpm_version_to_vre(rb_ivar_get(dep,id_ver)));
184
184
  sflag = NUM2INT(rb_ivar_get(dep, id_flags));
185
185
 
186
186
  if (rb_obj_is_kind_of(other,rpm_cDependency) == Qtrue){
187
187
  oflag = NUM2INT(rb_ivar_get(other, id_flags));
188
- oname = RSTRING(rb_ivar_get(other, id_name))->ptr;
189
- ovre = RSTRING(rpm_version_to_vre(rb_ivar_get(other,id_ver)))->ptr;
188
+ oname = RSTRING_PTR(rb_ivar_get(other, id_name));
189
+ ovre = RSTRING_PTR(rpm_version_to_vre(rb_ivar_get(other,id_ver)));
190
190
  other = rb_ivar_get(other,id_ver);
191
191
  } else if (rb_obj_is_kind_of(other,rpm_cVersion) == Qtrue){
192
- ovre = RSTRING(rpm_version_to_vre(other))->ptr;
192
+ ovre = RSTRING_PTR(rpm_version_to_vre(other));
193
193
  oname = name;
194
194
  if (!*ovre)
195
195
  oflag = 0;
@@ -99,4 +99,4 @@ $CFLAGS="#{$CFLAGS} -Werror -Wno-deprecated-declarations"
99
99
  system 'gcc -MM *.c >depend 2>/dev/null'
100
100
 
101
101
  create_header
102
- create_makefile('rpmmodule')
102
+ create_makefile('rpm')
@@ -36,7 +36,7 @@ file_initialize(VALUE file, VALUE path, VALUE md5sum, VALUE link_to,
36
36
  }
37
37
  rb_ivar_set(file, id_path, path);
38
38
  rb_ivar_set(file, id_md5sum, md5sum);
39
- rb_ivar_set(file, id_link_to, (!NIL_P(link_to) && RSTRING(link_to)->len) ? link_to : Qnil);
39
+ rb_ivar_set(file, id_link_to, (!NIL_P(link_to) && RSTRING_LEN(link_to)) ? link_to : Qnil);
40
40
  rb_ivar_set(file, id_size, rb_Integer(size));
41
41
  if (rb_obj_is_kind_of(mtime, rb_cTime) == Qfalse) {
42
42
  mtime = rb_time_new(NUM2INT(rb_Integer(mtime)), (time_t)0);
@@ -50,7 +50,7 @@ package_free(Header hdr)
50
50
  headerFree(hdr);
51
51
  }
52
52
 
53
- static VALUE inline
53
+ inline static VALUE
54
54
  package_new_from_header(VALUE klass, Header hdr)
55
55
  {
56
56
  VALUE p;
@@ -93,9 +93,9 @@ package_s_create(VALUE klass, VALUE name, VALUE version)
93
93
  }
94
94
 
95
95
  hdr = headerNew();
96
- headerAddEntry(hdr,RPMTAG_NAME,RPM_STRING_TYPE,RSTRING(name)->ptr,1);
97
- headerAddEntry(hdr,RPMTAG_VERSION,RPM_STRING_TYPE,RSTRING(rpm_version_get_v(version))->ptr,1);
98
- headerAddEntry(hdr,RPMTAG_RELEASE,RPM_STRING_TYPE,RSTRING(rpm_version_get_r(version))->ptr,1);
96
+ headerAddEntry(hdr,RPMTAG_NAME,RPM_STRING_TYPE,RSTRING_PTR(name),1);
97
+ headerAddEntry(hdr,RPMTAG_VERSION,RPM_STRING_TYPE,RSTRING_PTR(rpm_version_get_v(version)),1);
98
+ headerAddEntry(hdr,RPMTAG_RELEASE,RPM_STRING_TYPE,RSTRING_PTR(rpm_version_get_r(version)),1);
99
99
  if(!NIL_P(rpm_version_get_e(version))){
100
100
  int e = NUM2INT(rpm_version_get_e(version));
101
101
  headerAddEntry(hdr,RPMTAG_EPOCH,RPM_INT32_TYPE,&e,1);
@@ -133,13 +133,13 @@ package_s_open(VALUE klass, VALUE filename)
133
133
  rb_raise(rb_eTypeError, "illegal argument type");
134
134
  }
135
135
 
136
- fd = Fopen(RSTRING(filename)->ptr, "r");
136
+ fd = Fopen(RSTRING_PTR((filename)), "r");
137
137
  if (!fd) {
138
138
  rb_raise(rb_eRuntimeError, "can not open file %s",
139
- RSTRING(filename)->ptr);
139
+ RSTRING_PTR((filename)));
140
140
  }
141
141
 
142
- rc = read_header_from_file(fd, RSTRING(filename)->ptr, &hdr);
142
+ rc = read_header_from_file(fd, RSTRING_PTR((filename)), &hdr);
143
143
  Fclose(fd);
144
144
 
145
145
  switch (rc) {
@@ -188,12 +188,12 @@ package_s_load(VALUE klass, VALUE str)
188
188
  Check_Type(str, T_STRING);
189
189
 
190
190
  temp = ruby_rpm_make_temp_name();
191
- fd = Fopen(RSTRING(temp)->ptr, "wb+");
192
- Fwrite(RSTRING(str)->ptr, RSTRING(str)->len, 1, fd);
191
+ fd = Fopen(RSTRING_PTR((temp)), "wb+");
192
+ Fwrite(RSTRING_PTR((str)), RSTRING_LEN(str), 1, fd);
193
193
  Fseek(fd, 0, SEEK_SET);
194
194
  hdr = headerRead(fd, HEADER_MAGIC_YES);
195
195
  Fclose(fd);
196
- unlink(RSTRING(temp)->ptr);
196
+ unlink(RSTRING_PTR((temp)));
197
197
 
198
198
  if (!hdr) {
199
199
  rb_raise(rb_eArgError, "unable load RPM::Package");
@@ -254,8 +254,8 @@ rpm_package_add_dependency(VALUE pkg,VALUE dep)
254
254
  versiontag = NUM2INT(rpm_dependency_get_versiontag(dep));
255
255
  flagstag = NUM2INT(rpm_dependency_get_flagstag(dep));
256
256
 
257
- name = RSTRING(rpm_dependency_get_name(dep))->ptr;
258
- evr = RSTRING(rpm_version_to_vre(rpm_dependency_get_version(dep)))->ptr;
257
+ name = RSTRING_PTR((rpm_dependency_get_name(dep)));
258
+ evr = RSTRING_PTR((rpm_version_to_vre(rpm_dependency_get_version(dep))));
259
259
  flag = NUM2INT(rpm_dependency_get_flags(dep));
260
260
 
261
261
  headerAddOrAppendEntry(RPM_HEADER(pkg),nametag,RPM_STRING_ARRAY_TYPE,&name,1);
@@ -288,7 +288,7 @@ rpm_package_add_string_array(VALUE pkg,VALUE tag,VALUE val)
288
288
  if ((TYPE(val) != T_STRING)) {
289
289
  rb_raise(rb_eTypeError, "illegal argument type");
290
290
  }
291
- headerAddOrAppendEntry(RPM_HEADER(pkg),NUM2INT(tag),RPM_STRING_ARRAY_TYPE,&RSTRING(val)->ptr,1);
291
+ headerAddOrAppendEntry(RPM_HEADER(pkg),NUM2INT(tag),RPM_STRING_ARRAY_TYPE,RARRAY_PTR(val),1);
292
292
  return Qnil;
293
293
  }
294
294
 
@@ -298,7 +298,7 @@ rpm_package_add_string(VALUE pkg,VALUE tag,VALUE val)
298
298
  if ((TYPE(val) != T_STRING)) {
299
299
  rb_raise(rb_eTypeError, "illegal argument type");
300
300
  }
301
- headerAddEntry(RPM_HEADER(pkg),NUM2INT(tag),RPM_STRING_TYPE,RSTRING(val)->ptr,1);
301
+ headerAddEntry(RPM_HEADER(pkg),NUM2INT(tag),RPM_STRING_TYPE,RSTRING_PTR((val)),1);
302
302
  return Qnil;
303
303
  }
304
304
 
@@ -308,7 +308,7 @@ rpm_package_add_binary(VALUE pkg,VALUE tag,VALUE val)
308
308
  if ((TYPE(val) != T_STRING)) {
309
309
  rb_raise(rb_eTypeError, "illegal argument type");
310
310
  }
311
- headerAddEntry(RPM_HEADER(pkg),NUM2INT(tag),RPM_BIN_TYPE,RSTRING(val)->ptr,RSTRING(val)->len);
311
+ headerAddEntry(RPM_HEADER(pkg),NUM2INT(tag),RPM_BIN_TYPE,RSTRING_PTR((val)),RSTRING_LEN(val));
312
312
  return Qnil;
313
313
  }
314
314
 
@@ -700,35 +700,35 @@ rpm_package_get_files(VALUE pkg)
700
700
 
701
701
  files = rb_ary_new();
702
702
  if (!NIL_P(basenames)) {
703
- for (i = 0; i < RARRAY(basenames)->len; i++) {
703
+ for (i = 0; i < RARRAY_LEN(basenames); i++) {
704
704
  static char buf[BUFSIZ];
705
705
  VALUE file;
706
706
  buf[0] = '\0';
707
- stpcpy(stpcpy(buf, RSTRING(RARRAY(dirnames)->ptr[
708
- NUM2INT(RARRAY(diridxs)->ptr[i])])->ptr),
709
- RSTRING(RARRAY(basenames)->ptr[i])->ptr);
707
+ stpcpy(stpcpy(buf, RSTRING_PTR((RARRAY_PTR(dirnames))[
708
+ NUM2INT(RARRAY_PTR(diridxs)[i])])),
709
+ RSTRING_PTR((RARRAY_PTR(basenames)[i])));
710
710
  file = rpm_file_new(
711
711
  buf,
712
- RSTRING(RARRAY(md5list)->ptr[i])->ptr,
712
+ RSTRING_PTR((RARRAY_PTR(md5list)[i])),
713
713
  (NIL_P(linklist)
714
714
  ? NULL
715
- : RSTRING(RARRAY(linklist)->ptr[i])->ptr),
716
- NUM2UINT(RARRAY(sizelist)->ptr[i]),
717
- NUM2INT(RARRAY(mtimelist)->ptr[i]),
715
+ : RSTRING_PTR((RARRAY_PTR(linklist)[i]))),
716
+ NUM2UINT(RARRAY_PTR(sizelist)[i]),
717
+ NUM2INT(RARRAY_PTR(mtimelist)[i]),
718
718
  (NIL_P(ownerlist)
719
719
  ? NULL
720
- : RSTRING(RARRAY(ownerlist)->ptr[i])->ptr),
720
+ : RSTRING_PTR((RARRAY_PTR(ownerlist)[i]))),
721
721
  (NIL_P(grouplist)
722
722
  ? NULL
723
- : RSTRING(RARRAY(grouplist)->ptr[i])->ptr),
724
- NUM2UINT(RARRAY(rdevlist)->ptr[i]),
725
- NUM2UINT(RARRAY(modelist)->ptr[i]),
723
+ : RSTRING_PTR((RARRAY_PTR(grouplist)[i]))),
724
+ NUM2UINT(RARRAY_PTR(rdevlist)[i]),
725
+ NUM2UINT(RARRAY_PTR(modelist)[i]),
726
726
  (NIL_P(flaglist)
727
727
  ? RPMFILE_NONE
728
- : NUM2INT(RARRAY(flaglist)->ptr[i])),
728
+ : NUM2INT(RARRAY_PTR(flaglist)[i])),
729
729
  (NIL_P(statelist)
730
730
  ? RPMFILE_STATE_NORMAL
731
- : NUM2INT(RARRAY(statelist)->ptr[i])));
731
+ : NUM2INT(RARRAY_PTR(statelist)[i])));
732
732
  rb_ary_push(files, file);
733
733
  }
734
734
  }
@@ -925,7 +925,7 @@ rpm_package_dump(VALUE pkg)
925
925
  char* buf;
926
926
 
927
927
  temp = ruby_rpm_make_temp_name();
928
- fd = Fopen(RSTRING(temp)->ptr, "wb+");
928
+ fd = Fopen(RSTRING_PTR((temp)), "wb+");
929
929
  headerWrite(fd, RPM_HEADER(pkg), HEADER_MAGIC_YES);
930
930
  size = fdSize(fd);
931
931
 
@@ -934,7 +934,7 @@ rpm_package_dump(VALUE pkg)
934
934
  munmap(buf, size);
935
935
 
936
936
  Fclose(fd);
937
- unlink(RSTRING(temp)->ptr);
937
+ unlink(RSTRING_PTR((temp)));
938
938
 
939
939
  return dump;
940
940
  }
@@ -956,16 +956,16 @@ rpm_package_to_s(VALUE pkg)
956
956
  if (NIL_P(name)) {
957
957
  buf[0] = '\0';
958
958
  } else if (NIL_P(ver)) {
959
- snprintf(buf, BUFSIZ, "%s", RSTRING(name)->ptr);
959
+ snprintf(buf, BUFSIZ, "%s", RSTRING_PTR((name)));
960
960
  } else if (NIL_P(arch)) {
961
961
  snprintf(buf, BUFSIZ, "%s-%s",
962
- RSTRING(name)->ptr,
963
- RSTRING(rpm_version_to_s(ver))->ptr);
962
+ RSTRING_PTR((name)),
963
+ RSTRING_PTR((rpm_version_to_s(ver))));
964
964
  } else {
965
965
  snprintf(buf, BUFSIZ, "%s-%s-%s",
966
- RSTRING(name)->ptr,
967
- RSTRING(rpm_version_to_s(ver))->ptr,
968
- RSTRING(arch)->ptr);
966
+ RSTRING_PTR((name)),
967
+ RSTRING_PTR((rpm_version_to_s(ver))),
968
+ RSTRING_PTR((arch)));
969
969
  }
970
970
 
971
971
  return rb_str_new2(buf);
@@ -982,11 +982,11 @@ rpm_package_inspect(VALUE pkg)
982
982
  buf[0] = '\0';
983
983
  } else if (NIL_P(ver)) {
984
984
  snprintf(buf, BUFSIZ, "#<RPM::Package name=%s>",
985
- RSTRING(rb_inspect(name))->ptr);
985
+ RSTRING_PTR((rb_inspect(name))));
986
986
  } else {
987
987
  snprintf(buf, BUFSIZ, "#<RPM::Package name=%s, version=%s>",
988
- RSTRING(rb_inspect(name))->ptr,
989
- RSTRING(rb_inspect(ver))->ptr);
988
+ RSTRING_PTR((rb_inspect(name))),
989
+ RSTRING_PTR((rb_inspect(ver))));
990
990
  }
991
991
 
992
992
  return rb_str_new2(buf);