Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
5cf0f1a3
Commit
5cf0f1a3
authored
Apr 11, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added code to be more conservative about GCing.
Fixed setattr bugs.
parent
37130a76
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
33 deletions
+75
-33
src/Persistence/cPickleCache.c
src/Persistence/cPickleCache.c
+25
-11
src/ZODB/cPickleCache.c
src/ZODB/cPickleCache.c
+25
-11
src/persistent/cPickleCache.c
src/persistent/cPickleCache.c
+25
-11
No files found.
src/Persistence/cPickleCache.c
View file @
5cf0f1a3
/*
$Id: cPickleCache.c,v 1.
3 1997/03/28 20:18:34
jim Exp $
$Id: cPickleCache.c,v 1.
4 1997/04/11 19:13:21
jim Exp $
C implementation of a pickle jar cache.
...
...
@@ -56,7 +56,7 @@
(540) 371-6909
***************************************************************************/
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
3 1997/03/28 20:18:34
jim Exp $"
;
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
4 1997/04/11 19:13:21
jim Exp $"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -159,7 +159,7 @@ reallyfullgc(ccobject *self)
}
static
int
maybegc
(
ccobject
*
self
)
maybegc
(
ccobject
*
self
,
PyObject
*
thisv
)
{
int
n
,
s
;
time_t
now
,
dt
;
...
...
@@ -177,7 +177,7 @@ maybegc(ccobject *self)
{
if
(
PyDict_Next
(
self
->
data
,
&
(
self
->
position
),
&
key
,
&
v
))
{
if
(
gc_item
(
self
,
key
,
v
,
now
,
dt
)
<
0
)
return
-
1
;
if
(
v
!=
thisv
&&
gc_item
(
self
,
key
,
v
,
now
,
dt
)
<
0
)
return
-
1
;
}
else
self
->
position
=
0
;
...
...
@@ -245,6 +245,15 @@ static PyObject *
cc_getattr
(
ccobject
*
self
,
char
*
name
)
{
PyObject
*
r
;
if
(
*
name
==
'c'
)
{
if
(
strcmp
(
name
,
"cache_age"
)
==
0
)
return
PyInt_FromLong
(
self
->
cache_age
);
if
(
strcmp
(
name
,
"cache_size"
)
==
0
)
return
PyInt_FromLong
(
self
->
cache_size
);
}
if
(
r
=
Py_FindMethod
(
cc_methods
,
(
PyObject
*
)
self
,
name
))
return
r
;
PyErr_Clear
();
...
...
@@ -260,16 +269,16 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
if
(
strcmp
(
name
,
"cache_age"
)
==
0
)
{
if
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
0
;
else
return
-
1
;
UNLESS
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
-
1
;
if
(
v
>
0
)
self
->
cache_age
=
v
;
return
0
;
}
if
(
strcmp
(
name
,
"cache_size"
)
==
0
)
{
if
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
0
;
else
return
-
1
;
UNLESS
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
-
1
;
if
(
v
>
0
)
self
->
cache_size
=
v
;
return
0
;
}
}
PyErr_SetString
(
PyExc_AttributeError
,
name
);
...
...
@@ -308,7 +317,7 @@ cc_subscript(ccobject *self, PyObject *key)
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
}
UNLESS
(
-
1
!=
maybegc
(
self
))
UNLESS
(
-
1
!=
maybegc
(
self
,
r
))
{
Py_DECREF
(
r
);
return
NULL
;
...
...
@@ -343,13 +352,14 @@ cc_ass_sub(ccobject *self, PyObject *key, PyObject *v)
PyErr_Clear
();
UNLESS
(
-
1
!=
PyDict_SetItem
(
self
->
data
,
key
,
t
))
return
-
1
;
return
maybegc
(
self
,
t
);
Py_DECREF
(
t
);
}
else
{
UNLESS
(
-
1
!=
PyDict_DelItem
(
self
->
data
,
key
))
return
-
1
;
return
maybegc
(
self
,
NULL
);
}
return
maybegc
(
self
);
}
static
PyMappingMethods
cc_as_mapping
=
{
...
...
@@ -426,7 +436,7 @@ void
initcPickleCache
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
3
$"
;
char
*
rev
=
"$Revision: 1.
4
$"
;
Cctype
.
ob_type
=&
PyType_Type
;
...
...
@@ -454,6 +464,10 @@ initcPickleCache()
/******************************************************************************
$Log: cPickleCache.c,v $
Revision 1.4 1997/04/11 19:13:21 jim
Added code to be more conservative about GCing.
Fixed setattr bugs.
Revision 1.3 1997/03/28 20:18:34 jim
Simplified reinit logic.
...
...
src/ZODB/cPickleCache.c
View file @
5cf0f1a3
/*
$Id: cPickleCache.c,v 1.
3 1997/03/28 20:18:34
jim Exp $
$Id: cPickleCache.c,v 1.
4 1997/04/11 19:13:21
jim Exp $
C implementation of a pickle jar cache.
...
...
@@ -56,7 +56,7 @@
(540) 371-6909
***************************************************************************/
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
3 1997/03/28 20:18:34
jim Exp $"
;
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
4 1997/04/11 19:13:21
jim Exp $"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -159,7 +159,7 @@ reallyfullgc(ccobject *self)
}
static
int
maybegc
(
ccobject
*
self
)
maybegc
(
ccobject
*
self
,
PyObject
*
thisv
)
{
int
n
,
s
;
time_t
now
,
dt
;
...
...
@@ -177,7 +177,7 @@ maybegc(ccobject *self)
{
if
(
PyDict_Next
(
self
->
data
,
&
(
self
->
position
),
&
key
,
&
v
))
{
if
(
gc_item
(
self
,
key
,
v
,
now
,
dt
)
<
0
)
return
-
1
;
if
(
v
!=
thisv
&&
gc_item
(
self
,
key
,
v
,
now
,
dt
)
<
0
)
return
-
1
;
}
else
self
->
position
=
0
;
...
...
@@ -245,6 +245,15 @@ static PyObject *
cc_getattr
(
ccobject
*
self
,
char
*
name
)
{
PyObject
*
r
;
if
(
*
name
==
'c'
)
{
if
(
strcmp
(
name
,
"cache_age"
)
==
0
)
return
PyInt_FromLong
(
self
->
cache_age
);
if
(
strcmp
(
name
,
"cache_size"
)
==
0
)
return
PyInt_FromLong
(
self
->
cache_size
);
}
if
(
r
=
Py_FindMethod
(
cc_methods
,
(
PyObject
*
)
self
,
name
))
return
r
;
PyErr_Clear
();
...
...
@@ -260,16 +269,16 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
if
(
strcmp
(
name
,
"cache_age"
)
==
0
)
{
if
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
0
;
else
return
-
1
;
UNLESS
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
-
1
;
if
(
v
>
0
)
self
->
cache_age
=
v
;
return
0
;
}
if
(
strcmp
(
name
,
"cache_size"
)
==
0
)
{
if
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
0
;
else
return
-
1
;
UNLESS
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
-
1
;
if
(
v
>
0
)
self
->
cache_size
=
v
;
return
0
;
}
}
PyErr_SetString
(
PyExc_AttributeError
,
name
);
...
...
@@ -308,7 +317,7 @@ cc_subscript(ccobject *self, PyObject *key)
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
}
UNLESS
(
-
1
!=
maybegc
(
self
))
UNLESS
(
-
1
!=
maybegc
(
self
,
r
))
{
Py_DECREF
(
r
);
return
NULL
;
...
...
@@ -343,13 +352,14 @@ cc_ass_sub(ccobject *self, PyObject *key, PyObject *v)
PyErr_Clear
();
UNLESS
(
-
1
!=
PyDict_SetItem
(
self
->
data
,
key
,
t
))
return
-
1
;
return
maybegc
(
self
,
t
);
Py_DECREF
(
t
);
}
else
{
UNLESS
(
-
1
!=
PyDict_DelItem
(
self
->
data
,
key
))
return
-
1
;
return
maybegc
(
self
,
NULL
);
}
return
maybegc
(
self
);
}
static
PyMappingMethods
cc_as_mapping
=
{
...
...
@@ -426,7 +436,7 @@ void
initcPickleCache
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
3
$"
;
char
*
rev
=
"$Revision: 1.
4
$"
;
Cctype
.
ob_type
=&
PyType_Type
;
...
...
@@ -454,6 +464,10 @@ initcPickleCache()
/******************************************************************************
$Log: cPickleCache.c,v $
Revision 1.4 1997/04/11 19:13:21 jim
Added code to be more conservative about GCing.
Fixed setattr bugs.
Revision 1.3 1997/03/28 20:18:34 jim
Simplified reinit logic.
...
...
src/persistent/cPickleCache.c
View file @
5cf0f1a3
/*
$Id: cPickleCache.c,v 1.
3 1997/03/28 20:18:34
jim Exp $
$Id: cPickleCache.c,v 1.
4 1997/04/11 19:13:21
jim Exp $
C implementation of a pickle jar cache.
...
...
@@ -56,7 +56,7 @@
(540) 371-6909
***************************************************************************/
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
3 1997/03/28 20:18:34
jim Exp $"
;
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
4 1997/04/11 19:13:21
jim Exp $"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -159,7 +159,7 @@ reallyfullgc(ccobject *self)
}
static
int
maybegc
(
ccobject
*
self
)
maybegc
(
ccobject
*
self
,
PyObject
*
thisv
)
{
int
n
,
s
;
time_t
now
,
dt
;
...
...
@@ -177,7 +177,7 @@ maybegc(ccobject *self)
{
if
(
PyDict_Next
(
self
->
data
,
&
(
self
->
position
),
&
key
,
&
v
))
{
if
(
gc_item
(
self
,
key
,
v
,
now
,
dt
)
<
0
)
return
-
1
;
if
(
v
!=
thisv
&&
gc_item
(
self
,
key
,
v
,
now
,
dt
)
<
0
)
return
-
1
;
}
else
self
->
position
=
0
;
...
...
@@ -245,6 +245,15 @@ static PyObject *
cc_getattr
(
ccobject
*
self
,
char
*
name
)
{
PyObject
*
r
;
if
(
*
name
==
'c'
)
{
if
(
strcmp
(
name
,
"cache_age"
)
==
0
)
return
PyInt_FromLong
(
self
->
cache_age
);
if
(
strcmp
(
name
,
"cache_size"
)
==
0
)
return
PyInt_FromLong
(
self
->
cache_size
);
}
if
(
r
=
Py_FindMethod
(
cc_methods
,
(
PyObject
*
)
self
,
name
))
return
r
;
PyErr_Clear
();
...
...
@@ -260,16 +269,16 @@ cc_setattr(ccobject *self, char *name, PyObject *value)
if
(
strcmp
(
name
,
"cache_age"
)
==
0
)
{
if
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
0
;
else
return
-
1
;
UNLESS
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
-
1
;
if
(
v
>
0
)
self
->
cache_age
=
v
;
return
0
;
}
if
(
strcmp
(
name
,
"cache_size"
)
==
0
)
{
if
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
0
;
else
return
-
1
;
UNLESS
(
PyArg_Parse
(
value
,
"i"
,
&
v
))
return
-
1
;
if
(
v
>
0
)
self
->
cache_size
=
v
;
return
0
;
}
}
PyErr_SetString
(
PyExc_AttributeError
,
name
);
...
...
@@ -308,7 +317,7 @@ cc_subscript(ccobject *self, PyObject *key)
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
}
UNLESS
(
-
1
!=
maybegc
(
self
))
UNLESS
(
-
1
!=
maybegc
(
self
,
r
))
{
Py_DECREF
(
r
);
return
NULL
;
...
...
@@ -343,13 +352,14 @@ cc_ass_sub(ccobject *self, PyObject *key, PyObject *v)
PyErr_Clear
();
UNLESS
(
-
1
!=
PyDict_SetItem
(
self
->
data
,
key
,
t
))
return
-
1
;
return
maybegc
(
self
,
t
);
Py_DECREF
(
t
);
}
else
{
UNLESS
(
-
1
!=
PyDict_DelItem
(
self
->
data
,
key
))
return
-
1
;
return
maybegc
(
self
,
NULL
);
}
return
maybegc
(
self
);
}
static
PyMappingMethods
cc_as_mapping
=
{
...
...
@@ -426,7 +436,7 @@ void
initcPickleCache
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
3
$"
;
char
*
rev
=
"$Revision: 1.
4
$"
;
Cctype
.
ob_type
=&
PyType_Type
;
...
...
@@ -454,6 +464,10 @@ initcPickleCache()
/******************************************************************************
$Log: cPickleCache.c,v $
Revision 1.4 1997/04/11 19:13:21 jim
Added code to be more conservative about GCing.
Fixed setattr bugs.
Revision 1.3 1997/03/28 20:18:34 jim
Simplified reinit logic.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment