gdbm 2.0.0.beta1 → 2.0.0
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 +5 -5
- data/ext/gdbm/gdbm.c +20 -24
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d8712d243347c6f11adadc74dc9ecd7d75d2b73033ed44f5c22bf6091020945e
|
4
|
+
data.tar.gz: 57c8a736e7d4266d81c8b7f05ad27a5e42148b6a6d13076ce2a05db2766ff499
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e30eaa362c15a803a5477dbf065469a837fd8d28008724975eadf62edc64c11c71850657f70c8ff92fe56fe907e63e3203d3f8ec4411bc34608587cfd94dd2de
|
7
|
+
data.tar.gz: e77c38c65a4fd19eb7bd2478193d6678a7e075216b79ffbcecc8bdb3d226f5397f875ab034721c15af6c2a63eb6a20003af0912362e1d46575a0d52721567d70
|
data/ext/gdbm/gdbm.c
CHANGED
@@ -102,7 +102,6 @@ closed_dbm(void)
|
|
102
102
|
|
103
103
|
#define GetDBM(obj, dbmp) do {\
|
104
104
|
TypedData_Get_Struct((obj), struct dbmdata, &dbm_type, (dbmp));\
|
105
|
-
if ((dbmp) == 0) closed_dbm();\
|
106
105
|
if ((dbmp)->di_dbm == 0) closed_dbm();\
|
107
106
|
} while (0)
|
108
107
|
|
@@ -115,21 +114,18 @@ static void
|
|
115
114
|
free_dbm(void *ptr)
|
116
115
|
{
|
117
116
|
struct dbmdata *dbmp = ptr;
|
118
|
-
if (dbmp)
|
119
|
-
|
120
|
-
|
121
|
-
}
|
117
|
+
if (dbmp->di_dbm)
|
118
|
+
gdbm_close(dbmp->di_dbm);
|
119
|
+
xfree(dbmp);
|
122
120
|
}
|
123
121
|
|
124
122
|
static size_t
|
125
123
|
memsize_dbm(const void *ptr)
|
126
124
|
{
|
127
|
-
size_t size = 0;
|
128
125
|
const struct dbmdata *dbmp = ptr;
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
}
|
126
|
+
size_t size = sizeof(*dbmp);
|
127
|
+
if (dbmp->di_dbm)
|
128
|
+
size += DBM_SIZEOF_DBM;
|
133
129
|
return size;
|
134
130
|
}
|
135
131
|
|
@@ -170,8 +166,6 @@ fgdbm_closed(VALUE obj)
|
|
170
166
|
struct dbmdata *dbmp;
|
171
167
|
|
172
168
|
TypedData_Get_Struct(obj, struct dbmdata, &dbm_type, dbmp);
|
173
|
-
if (dbmp == 0)
|
174
|
-
return Qtrue;
|
175
169
|
if (dbmp->di_dbm == 0)
|
176
170
|
return Qtrue;
|
177
171
|
|
@@ -181,7 +175,9 @@ fgdbm_closed(VALUE obj)
|
|
181
175
|
static VALUE
|
182
176
|
fgdbm_s_alloc(VALUE klass)
|
183
177
|
{
|
184
|
-
|
178
|
+
struct dbmdata *dbmp;
|
179
|
+
|
180
|
+
return TypedData_Make_Struct(klass, struct dbmdata, &dbm_type, dbmp);
|
185
181
|
}
|
186
182
|
|
187
183
|
/*
|
@@ -215,6 +211,7 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
|
|
215
211
|
struct dbmdata *dbmp;
|
216
212
|
int mode, flags = 0;
|
217
213
|
|
214
|
+
TypedData_Get_Struct(obj, struct dbmdata, &dbm_type, dbmp);
|
218
215
|
if (rb_scan_args(argc, argv, "12", &file, &vmode, &vflags) == 1) {
|
219
216
|
mode = 0666; /* default value */
|
220
217
|
}
|
@@ -228,7 +225,7 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
|
|
228
225
|
if (!NIL_P(vflags))
|
229
226
|
flags = NUM2INT(vflags);
|
230
227
|
|
231
|
-
|
228
|
+
FilePathValue(file);
|
232
229
|
|
233
230
|
#ifdef GDBM_CLOEXEC
|
234
231
|
/* GDBM_CLOEXEC is available since gdbm 1.10. */
|
@@ -268,9 +265,8 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
|
|
268
265
|
rb_raise(rb_eGDBMError, "%s", gdbm_strerror(gdbm_errno));
|
269
266
|
}
|
270
267
|
|
271
|
-
|
272
|
-
|
273
|
-
DATA_PTR(obj) = dbmp;
|
268
|
+
if (dbmp->di_dbm)
|
269
|
+
gdbm_close(dbmp->di_dbm);
|
274
270
|
dbmp->di_dbm = dbm;
|
275
271
|
dbmp->di_size = -1;
|
276
272
|
|
@@ -334,7 +330,7 @@ rb_gdbm_fetch2(GDBM_FILE dbm, VALUE keystr)
|
|
334
330
|
datum key;
|
335
331
|
long len;
|
336
332
|
|
337
|
-
|
333
|
+
ExportStringValue(keystr);
|
338
334
|
len = RSTRING_LEN(keystr);
|
339
335
|
if (TOO_LONG(len)) return Qnil;
|
340
336
|
key.dptr = RSTRING_PTR(keystr);
|
@@ -450,7 +446,7 @@ fgdbm_key(VALUE obj, VALUE valstr)
|
|
450
446
|
GDBM_FILE dbm;
|
451
447
|
VALUE keystr, valstr2;
|
452
448
|
|
453
|
-
|
449
|
+
ExportStringValue(valstr);
|
454
450
|
GetDBM2(obj, dbmp, dbm);
|
455
451
|
for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
|
456
452
|
keystr = rb_gdbm_nextkey(dbm, keystr)) {
|
@@ -538,7 +534,7 @@ rb_gdbm_delete(VALUE obj, VALUE keystr)
|
|
538
534
|
long len;
|
539
535
|
|
540
536
|
rb_gdbm_modify(obj);
|
541
|
-
|
537
|
+
ExportStringValue(keystr);
|
542
538
|
len = RSTRING_LEN(keystr);
|
543
539
|
if (TOO_LONG(len)) return Qnil;
|
544
540
|
key.dptr = RSTRING_PTR(keystr);
|
@@ -725,8 +721,8 @@ fgdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
|
|
725
721
|
GDBM_FILE dbm;
|
726
722
|
|
727
723
|
rb_gdbm_modify(obj);
|
728
|
-
|
729
|
-
|
724
|
+
ExportStringValue(keystr);
|
725
|
+
ExportStringValue(valstr);
|
730
726
|
|
731
727
|
key.dptr = RSTRING_PTR(keystr);
|
732
728
|
key.dsize = RSTRING_LENINT(keystr);
|
@@ -991,7 +987,7 @@ fgdbm_has_key(VALUE obj, VALUE keystr)
|
|
991
987
|
GDBM_FILE dbm;
|
992
988
|
long len;
|
993
989
|
|
994
|
-
|
990
|
+
ExportStringValue(keystr);
|
995
991
|
len = RSTRING_LENINT(keystr);
|
996
992
|
if (TOO_LONG(len)) return Qfalse;
|
997
993
|
key.dptr = RSTRING_PTR(keystr);
|
@@ -1018,7 +1014,7 @@ fgdbm_has_value(VALUE obj, VALUE valstr)
|
|
1018
1014
|
GDBM_FILE dbm;
|
1019
1015
|
VALUE keystr, valstr2;
|
1020
1016
|
|
1021
|
-
|
1017
|
+
ExportStringValue(valstr);
|
1022
1018
|
GetDBM2(obj, dbmp, dbm);
|
1023
1019
|
for (keystr = rb_gdbm_firstkey(dbm); RTEST(keystr);
|
1024
1020
|
keystr = rb_gdbm_nextkey(dbm, keystr)) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gdbm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
@@ -88,15 +88,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements:
|
89
89
|
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: 2.
|
91
|
+
version: 2.3.0
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.7.3
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Ruby extension for GNU dbm.
|