sdbm 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ext/sdbm/_sdbm.c +28 -28
- data/ext/sdbm/init.c +9 -11
- metadata +5 -6
- data/ext/sdbm/depend +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '081d57660dd60ed30d2cae09012534fc6d30e35b1cccb3347a7b4da3a83fcbba'
|
4
|
+
data.tar.gz: 15c064a52268ec708a2edbebfc2e1d347dacd9040320076e66ea8b1f7c451307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc76b80abbdf72afe264d13d526212a2ee2d6522f160100089ead9048a0903ba16dc537887936e9227390ac2e0b04c1e40b475e1deecdfd2f1ed4f641abf3a2
|
7
|
+
data.tar.gz: 332e9da9cf41f4b2fa716d114355ac170ca69bc85939984c88e60c6396e93a523ed7ce8655c66f4af723304203a2e2a896830269f302b5208408be9c4bd82f32
|
data/ext/sdbm/_sdbm.c
CHANGED
@@ -176,24 +176,24 @@ sdbm_open(register char *file, register int flags, register int mode)
|
|
176
176
|
static int
|
177
177
|
fd_set_cloexec(int fd)
|
178
178
|
{
|
179
|
-
|
179
|
+
/* MinGW don't have F_GETFD and FD_CLOEXEC. [ruby-core:40281] */
|
180
180
|
#ifdef F_GETFD
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
181
|
+
int flags, ret;
|
182
|
+
flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */
|
183
|
+
if (flags == -1) {
|
184
|
+
return -1;
|
185
|
+
}
|
186
|
+
if (2 < fd) {
|
187
|
+
if (!(flags & FD_CLOEXEC)) {
|
188
|
+
flags |= FD_CLOEXEC;
|
189
|
+
ret = fcntl(fd, F_SETFD, flags);
|
190
|
+
if (ret == -1) {
|
191
|
+
return -1;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}
|
195
195
|
#endif
|
196
|
-
|
196
|
+
return 0;
|
197
197
|
}
|
198
198
|
|
199
199
|
DBM *
|
@@ -400,20 +400,20 @@ makroom(register DBM *db, long int hash, int need)
|
|
400
400
|
*/
|
401
401
|
|
402
402
|
#if defined _WIN32
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
403
|
+
/*
|
404
|
+
* Fill hole with 0 if made it.
|
405
|
+
* (hole is NOT read as 0)
|
406
|
+
*/
|
407
|
+
oldtail = lseek(db->pagf, 0L, SEEK_END);
|
408
|
+
memset(zer, 0, PBLKSIZ);
|
409
|
+
while (OFF_PAG(newp) > oldtail) {
|
410
|
+
if (lseek(db->pagf, 0L, SEEK_END) < 0 ||
|
411
|
+
write(db->pagf, zer, PBLKSIZ) < 0) {
|
412
412
|
|
413
|
-
|
413
|
+
return 0;
|
414
|
+
}
|
415
|
+
oldtail += PBLKSIZ;
|
414
416
|
}
|
415
|
-
oldtail += PBLKSIZ;
|
416
|
-
}
|
417
417
|
#endif
|
418
418
|
|
419
419
|
if (hash & (db->hmask + 1)) {
|
data/ext/sdbm/init.c
CHANGED
@@ -79,7 +79,6 @@ closed_sdbm(void)
|
|
79
79
|
|
80
80
|
#define GetDBM(obj, dbmp) do {\
|
81
81
|
TypedData_Get_Struct((obj), struct dbmdata, &sdbm_type, (dbmp));\
|
82
|
-
if ((dbmp) == 0) closed_sdbm();\
|
83
82
|
if ((dbmp)->di_dbm == 0) closed_sdbm();\
|
84
83
|
} while (0)
|
85
84
|
|
@@ -100,12 +99,10 @@ free_sdbm(void *ptr)
|
|
100
99
|
static size_t
|
101
100
|
memsize_dbm(const void *ptr)
|
102
101
|
{
|
103
|
-
size_t size = 0;
|
104
102
|
const struct dbmdata *dbmp = ptr;
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
}
|
103
|
+
size_t size = sizeof(*dbmp);
|
104
|
+
if (dbmp->di_dbm)
|
105
|
+
size += sizeof(DBM);
|
109
106
|
return size;
|
110
107
|
}
|
111
108
|
|
@@ -148,8 +145,6 @@ fsdbm_closed(VALUE obj)
|
|
148
145
|
struct dbmdata *dbmp;
|
149
146
|
|
150
147
|
TypedData_Get_Struct(obj, struct dbmdata, &sdbm_type, dbmp);
|
151
|
-
if (dbmp == 0)
|
152
|
-
return Qtrue;
|
153
148
|
if (dbmp->di_dbm == 0)
|
154
149
|
return Qtrue;
|
155
150
|
|
@@ -159,7 +154,9 @@ fsdbm_closed(VALUE obj)
|
|
159
154
|
static VALUE
|
160
155
|
fsdbm_alloc(VALUE klass)
|
161
156
|
{
|
162
|
-
|
157
|
+
struct dbmdata *dbmp;
|
158
|
+
|
159
|
+
return TypedData_Make_Struct(klass, struct dbmdata, &sdbm_type, dbmp);
|
163
160
|
}
|
164
161
|
/*
|
165
162
|
* call-seq:
|
@@ -184,6 +181,7 @@ fsdbm_initialize(int argc, VALUE *argv, VALUE obj)
|
|
184
181
|
struct dbmdata *dbmp;
|
185
182
|
int mode;
|
186
183
|
|
184
|
+
TypedData_Get_Struct(obj, struct dbmdata, &sdbm_type, dbmp);
|
187
185
|
if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
|
188
186
|
mode = 0666; /* default value */
|
189
187
|
}
|
@@ -208,8 +206,8 @@ fsdbm_initialize(int argc, VALUE *argv, VALUE obj)
|
|
208
206
|
rb_sys_fail_str(file);
|
209
207
|
}
|
210
208
|
|
211
|
-
|
212
|
-
|
209
|
+
if (dbmp->di_dbm)
|
210
|
+
sdbm_close(dbmp->di_dbm);
|
213
211
|
dbmp->di_dbm = dbm;
|
214
212
|
dbmp->di_size = -1;
|
215
213
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdbm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -47,11 +47,10 @@ extensions:
|
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
49
|
- ext/sdbm/_sdbm.c
|
50
|
-
- ext/sdbm/depend
|
51
50
|
- ext/sdbm/extconf.rb
|
52
51
|
- ext/sdbm/init.c
|
53
52
|
- ext/sdbm/sdbm.h
|
54
|
-
homepage: https://
|
53
|
+
homepage: https://github.com/ruby/sdbm
|
55
54
|
licenses:
|
56
55
|
- BSD-2-Clause
|
57
56
|
metadata: {}
|
@@ -63,7 +62,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
62
|
requirements:
|
64
63
|
- - ">="
|
65
64
|
- !ruby/object:Gem::Version
|
66
|
-
version: 2.
|
65
|
+
version: 2.3.0
|
67
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
67
|
requirements:
|
69
68
|
- - ">="
|
@@ -71,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
70
|
version: '0'
|
72
71
|
requirements: []
|
73
72
|
rubyforge_project:
|
74
|
-
rubygems_version: 2.
|
73
|
+
rubygems_version: 2.7.3
|
75
74
|
signing_key:
|
76
75
|
specification_version: 4
|
77
76
|
summary: Provides a simple file-based key-value store with String keys and values.
|
data/ext/sdbm/depend
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# AUTOGENERATED DEPENDENCIES START
|
2
|
-
_sdbm.o: $(RUBY_EXTCONF_H)
|
3
|
-
_sdbm.o: $(arch_hdrdir)/ruby/config.h
|
4
|
-
_sdbm.o: $(hdrdir)/ruby/backward.h
|
5
|
-
_sdbm.o: $(hdrdir)/ruby/defines.h
|
6
|
-
_sdbm.o: $(hdrdir)/ruby/intern.h
|
7
|
-
_sdbm.o: $(hdrdir)/ruby/missing.h
|
8
|
-
_sdbm.o: $(hdrdir)/ruby/ruby.h
|
9
|
-
_sdbm.o: $(hdrdir)/ruby/st.h
|
10
|
-
_sdbm.o: $(hdrdir)/ruby/subst.h
|
11
|
-
_sdbm.o: _sdbm.c
|
12
|
-
_sdbm.o: sdbm.h
|
13
|
-
init.o: $(RUBY_EXTCONF_H)
|
14
|
-
init.o: $(arch_hdrdir)/ruby/config.h
|
15
|
-
init.o: $(hdrdir)/ruby/backward.h
|
16
|
-
init.o: $(hdrdir)/ruby/defines.h
|
17
|
-
init.o: $(hdrdir)/ruby/intern.h
|
18
|
-
init.o: $(hdrdir)/ruby/missing.h
|
19
|
-
init.o: $(hdrdir)/ruby/ruby.h
|
20
|
-
init.o: $(hdrdir)/ruby/st.h
|
21
|
-
init.o: $(hdrdir)/ruby/subst.h
|
22
|
-
# init.o: $(top_srcdir)/include/ruby.h
|
23
|
-
init.o: init.c
|
24
|
-
init.o: sdbm.h
|
25
|
-
# AUTOGENERATED DEPENDENCIES END
|