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
bbd033c3
Commit
bbd033c3
authored
Apr 02, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More reformatting to match Python C style.
parent
32968b3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
111 deletions
+84
-111
src/Persistence/cPickleCache.c
src/Persistence/cPickleCache.c
+28
-37
src/ZODB/cPickleCache.c
src/ZODB/cPickleCache.c
+28
-37
src/persistent/cPickleCache.c
src/persistent/cPickleCache.c
+28
-37
No files found.
src/Persistence/cPickleCache.c
View file @
bbd033c3
...
...
@@ -15,7 +15,7 @@
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.4
7 2002/04/02 14:35:36 gvanrossum
Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.4
8 2002/04/02 19:47:19 jeremy
Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -641,12 +641,13 @@ cc_subscript(ccobject *self, PyObject *key)
{
PyObject
*
r
;
if
(
check_ring
(
self
,
"__getitem__"
))
return
NULL
;
if
(
check_ring
(
self
,
"__getitem__"
))
return
NULL
;
UNLESS
(
r
=
(
PyObject
*
)
object_from_oid
(
self
,
key
))
{
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
r
=
(
PyObject
*
)
object_from_oid
(
self
,
key
);
if
(
r
==
NULL
)
{
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
}
return
r
;
...
...
@@ -696,7 +697,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
object_again
!=
v
)
{
Py_DECREF
(
object_again
);
PyErr_SetString
(
PyExc_ValueError
,
"Can not re-register object under a different oid"
);
"Can not re-register object under a different oid"
);
return
-
1
;
}
else
{
/* re-register under the same oid - no work needed */
...
...
@@ -815,10 +816,10 @@ cc_ass_sub(ccobject *self, PyObject *key, PyObject *v)
}
static
int
_check_ring
(
ccobject
*
self
,
const
char
*
context
)
_check_ring
(
ccobject
*
self
,
const
char
*
context
)
{
CPersistentRing
*
here
=
&
(
self
->
ring_home
);
int
expected
=
1
+
self
->
non_ghost_count
;
int
expected
=
1
+
self
->
non_ghost_count
;
int
total
=
0
;
do
{
if
(
++
total
>
(
expected
+
10
))
...
...
@@ -835,31 +836,28 @@ _check_ring(ccobject *self,const char *context)
return
9
;
if
(
here
->
next
->
prev
!=
here
)
return
10
;
if
(
!
self
->
ring_lock
)
{
if
(
!
self
->
ring_lock
)
{
/* if the ring must be locked then it only contains object other than persistent instances */
if
(
here
!=&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
if
(
here
!=
&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
return
13
;
}
}
here
=
here
->
next
;
}
while
(
here
!=&
self
->
ring_home
);
}
while
(
here
!=
&
self
->
ring_home
);
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
}
return
0
;
}
...
...
@@ -889,22 +887,15 @@ static int
present_in_ring
(
ccobject
*
self
,
CPersistentRing
*
target
)
{
CPersistentRing
*
here
=
self
->
ring_home
.
next
;
while
(
1
)
{
if
(
here
==
target
)
{
while
(
1
)
{
if
(
here
==
target
)
return
1
;
}
if
(
here
==&
self
->
ring_home
)
{
/* back to the home position, and we didnt find it */
return
0
;
}
if
(
here
==
&
self
->
ring_home
)
return
0
;
/* back to the home position, and we didnt find it */
here
=
here
->
next
;
}
}
static
PyMappingMethods
cc_as_mapping
=
{
(
inquiry
)
cc_length
,
/*mp_length*/
(
binaryfunc
)
cc_subscript
,
/*mp_subscript*/
...
...
src/ZODB/cPickleCache.c
View file @
bbd033c3
...
...
@@ -15,7 +15,7 @@
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.4
7 2002/04/02 14:35:36 gvanrossum
Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.4
8 2002/04/02 19:47:19 jeremy
Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -641,12 +641,13 @@ cc_subscript(ccobject *self, PyObject *key)
{
PyObject
*
r
;
if
(
check_ring
(
self
,
"__getitem__"
))
return
NULL
;
if
(
check_ring
(
self
,
"__getitem__"
))
return
NULL
;
UNLESS
(
r
=
(
PyObject
*
)
object_from_oid
(
self
,
key
))
{
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
r
=
(
PyObject
*
)
object_from_oid
(
self
,
key
);
if
(
r
==
NULL
)
{
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
}
return
r
;
...
...
@@ -696,7 +697,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
object_again
!=
v
)
{
Py_DECREF
(
object_again
);
PyErr_SetString
(
PyExc_ValueError
,
"Can not re-register object under a different oid"
);
"Can not re-register object under a different oid"
);
return
-
1
;
}
else
{
/* re-register under the same oid - no work needed */
...
...
@@ -815,10 +816,10 @@ cc_ass_sub(ccobject *self, PyObject *key, PyObject *v)
}
static
int
_check_ring
(
ccobject
*
self
,
const
char
*
context
)
_check_ring
(
ccobject
*
self
,
const
char
*
context
)
{
CPersistentRing
*
here
=
&
(
self
->
ring_home
);
int
expected
=
1
+
self
->
non_ghost_count
;
int
expected
=
1
+
self
->
non_ghost_count
;
int
total
=
0
;
do
{
if
(
++
total
>
(
expected
+
10
))
...
...
@@ -835,31 +836,28 @@ _check_ring(ccobject *self,const char *context)
return
9
;
if
(
here
->
next
->
prev
!=
here
)
return
10
;
if
(
!
self
->
ring_lock
)
{
if
(
!
self
->
ring_lock
)
{
/* if the ring must be locked then it only contains object other than persistent instances */
if
(
here
!=&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
if
(
here
!=
&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
return
13
;
}
}
here
=
here
->
next
;
}
while
(
here
!=&
self
->
ring_home
);
}
while
(
here
!=
&
self
->
ring_home
);
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
}
return
0
;
}
...
...
@@ -889,22 +887,15 @@ static int
present_in_ring
(
ccobject
*
self
,
CPersistentRing
*
target
)
{
CPersistentRing
*
here
=
self
->
ring_home
.
next
;
while
(
1
)
{
if
(
here
==
target
)
{
while
(
1
)
{
if
(
here
==
target
)
return
1
;
}
if
(
here
==&
self
->
ring_home
)
{
/* back to the home position, and we didnt find it */
return
0
;
}
if
(
here
==
&
self
->
ring_home
)
return
0
;
/* back to the home position, and we didnt find it */
here
=
here
->
next
;
}
}
static
PyMappingMethods
cc_as_mapping
=
{
(
inquiry
)
cc_length
,
/*mp_length*/
(
binaryfunc
)
cc_subscript
,
/*mp_subscript*/
...
...
src/persistent/cPickleCache.c
View file @
bbd033c3
...
...
@@ -15,7 +15,7 @@
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.4
7 2002/04/02 14:35:36 gvanrossum
Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.4
8 2002/04/02 19:47:19 jeremy
Exp $
\n
"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -641,12 +641,13 @@ cc_subscript(ccobject *self, PyObject *key)
{
PyObject
*
r
;
if
(
check_ring
(
self
,
"__getitem__"
))
return
NULL
;
if
(
check_ring
(
self
,
"__getitem__"
))
return
NULL
;
UNLESS
(
r
=
(
PyObject
*
)
object_from_oid
(
self
,
key
))
{
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
r
=
(
PyObject
*
)
object_from_oid
(
self
,
key
);
if
(
r
==
NULL
)
{
PyErr_SetObject
(
PyExc_KeyError
,
key
);
return
NULL
;
}
return
r
;
...
...
@@ -696,7 +697,7 @@ cc_add_item(ccobject *self, PyObject *key, PyObject *v)
if
(
object_again
!=
v
)
{
Py_DECREF
(
object_again
);
PyErr_SetString
(
PyExc_ValueError
,
"Can not re-register object under a different oid"
);
"Can not re-register object under a different oid"
);
return
-
1
;
}
else
{
/* re-register under the same oid - no work needed */
...
...
@@ -815,10 +816,10 @@ cc_ass_sub(ccobject *self, PyObject *key, PyObject *v)
}
static
int
_check_ring
(
ccobject
*
self
,
const
char
*
context
)
_check_ring
(
ccobject
*
self
,
const
char
*
context
)
{
CPersistentRing
*
here
=
&
(
self
->
ring_home
);
int
expected
=
1
+
self
->
non_ghost_count
;
int
expected
=
1
+
self
->
non_ghost_count
;
int
total
=
0
;
do
{
if
(
++
total
>
(
expected
+
10
))
...
...
@@ -835,31 +836,28 @@ _check_ring(ccobject *self,const char *context)
return
9
;
if
(
here
->
next
->
prev
!=
here
)
return
10
;
if
(
!
self
->
ring_lock
)
{
if
(
!
self
->
ring_lock
)
{
/* if the ring must be locked then it only contains object other than persistent instances */
if
(
here
!=&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
if
(
here
!=
&
self
->
ring_home
)
{
cPersistentObject
*
object
=
object_from_ring
(
self
,
here
,
context
);
if
(
!
object
)
return
12
;
if
(
object
->
state
==
cPersistent_GHOST_STATE
)
return
13
;
}
}
here
=
here
->
next
;
}
while
(
here
!=&
self
->
ring_home
);
}
while
(
here
!=
&
self
->
ring_home
);
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
if
(
self
->
ring_lock
)
{
if
(
total
<
expected
)
return
6
;
/* ring too small; too big is ok when locked */
}
else
{
if
(
total
!=
expected
)
return
14
;
/* ring size wrong, or bad ghost accounting */
}
return
0
;
}
...
...
@@ -889,22 +887,15 @@ static int
present_in_ring
(
ccobject
*
self
,
CPersistentRing
*
target
)
{
CPersistentRing
*
here
=
self
->
ring_home
.
next
;
while
(
1
)
{
if
(
here
==
target
)
{
while
(
1
)
{
if
(
here
==
target
)
return
1
;
}
if
(
here
==&
self
->
ring_home
)
{
/* back to the home position, and we didnt find it */
return
0
;
}
if
(
here
==
&
self
->
ring_home
)
return
0
;
/* back to the home position, and we didnt find it */
here
=
here
->
next
;
}
}
static
PyMappingMethods
cc_as_mapping
=
{
(
inquiry
)
cc_length
,
/*mp_length*/
(
binaryfunc
)
cc_subscript
,
/*mp_subscript*/
...
...
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