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
4cca7def
Commit
4cca7def
authored
Sep 08, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added logic to save data in binary form.
parent
18a48706
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
26 deletions
+37
-26
src/ZODB/intSet.c
src/ZODB/intSet.c
+37
-26
No files found.
src/ZODB/intSet.c
View file @
4cca7def
...
...
@@ -10,7 +10,7 @@
static
char
intSet_module_documentation
[]
=
""
"
\n
$Id: intSet.c,v 1.
1 1997/08/05 14:55:22
jim Exp $"
"
\n
$Id: intSet.c,v 1.
2 1997/09/08 18:41:59
jim Exp $"
;
#include <limits.h>
...
...
@@ -179,23 +179,35 @@ intSet_remove(intSet *self, PyObject *args)
if
(
intSet_modify
(
self
,
key
,
0
)
<
0
)
return
NULL
;
RETURN_NONE
;
}
static
PyObject
*
intSet_clear
(
intSet
*
self
,
PyObject
*
args
)
{
self
->
len
=
0
;
if
(
PER_CHANGED
(
self
)
<
0
)
return
PER_RETURN
(
self
,
NULL
);
RETURN_NONE
;
}
static
PyObject
*
intSet___getstate__
(
intSet
*
self
,
PyObject
*
args
)
{
PyObject
*
r
,
*
item
;
PyObject
*
r
=
0
;
int
i
,
l
;
char
*
c
;
INTSET_DATA_TYPE
*
d
;
PER_USE_OR_RETURN
(
self
,
NULL
);
UNLESS
(
r
=
PyTuple_New
(
self
->
len
))
return
PER_RETURN
(
self
,
NULL
);
l
=
self
->
len
;
UNLESS
(
r
=
PyString_FromStringAndSize
(
NULL
,
l
*
4
))
goto
err
;
UNLESS
(
c
=
PyString_AsString
(
r
))
goto
err
;
d
=
self
->
data
;
for
(
i
=
self
->
len
;
--
i
>=
0
;)
for
(
i
=
0
;
i
<
l
;
i
++
,
*
d
++
)
{
UNLESS
(
item
=
PyInt_FromLong
(
d
[
i
]))
goto
err
;
PyTuple_SET_ITEM
(
r
,
i
,
item
);
*
c
++
=
(
int
)(
*
d
&
0xff
);
*
c
++
=
(
int
)((
*
d
>>
8
)
&
0xff
);
*
c
++
=
(
int
)((
*
d
>>
16
)
&
0xff
);
*
c
++
=
(
int
)((
*
d
>>
24
)
&
0xff
);
}
return
PER_RETURN
(
self
,
r
);
...
...
@@ -204,44 +216,40 @@ err:
Py_DECREF
(
r
);
return
PER_RETURN
(
self
,
NULL
);
}
static
PyObject
*
intSet_clear
(
intSet
*
self
,
PyObject
*
args
)
{
self
->
len
=
0
;
if
(
PER_CHANGED
(
self
)
<
0
)
return
PER_RETURN
(
self
,
NULL
);
RETURN_NONE
;
}
static
PyObject
*
intSet___setstate__
(
intSet
*
self
,
PyObject
*
args
)
{
PyObject
*
data
,
*
ok
=
0
;
int
i
,
l
;
PyObject
*
data
;
int
i
,
l
,
v
;
char
*
c
;
INTSET_DATA_TYPE
k
;
PER_PREVENT_DEACTIVATION
(
self
);
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
data
))
return
PER_RETURN
(
self
,
NULL
);
if
((
l
=
PyObject_Length
(
data
))
<
0
)
return
PER_RETURN
(
self
,
NULL
);
UNLESS
(
c
=
PyString_AsString
(
data
))
return
PER_RETURN
(
self
,
NULL
);
if
((
l
=
PyString_Size
(
data
))
<
0
)
return
PER_RETURN
(
self
,
NULL
);
l
/=
4
;
intSet_clear
(
self
,
NULL
);
if
(
l
>
self
->
size
&&
intSet_grow
(
self
,
l
)
<
0
)
return
PER_RETURN
(
self
,
NULL
);
PyErr_Clear
();
for
(
i
=
l
;
--
i
>=
0
;
)
for
(
i
=
0
;
i
<
l
;
i
++
)
{
UNLESS_ASSIGN
(
ok
,
PySequence_GetItem
(
data
,
i
))
return
PER_RETURN
(
self
,
NULL
)
;
k
=
PyInt_AsLong
(
ok
)
;
if
(
k
<
0
&&
PyErr_Occurred
())
return
PER_RETURN
(
self
,
NULL
)
;
self
->
data
[
i
]
=
k
;
v
=
((
int
)(
unsigned
char
)
*
c
++
)
;
v
|=
((
int
)(
unsigned
char
)
*
c
++
)
<<
8
;
v
|=
((
int
)(
unsigned
char
)
*
c
++
)
<<
16
;
v
|=
((
int
)(
unsigned
char
)
*
c
++
)
<<
24
;
self
->
data
[
i
]
=
v
;
}
self
->
len
=
l
;
Py_XDECREF
(
ok
);
Py_INCREF
(
Py_None
);
return
PER_RETURN
(
self
,
Py_None
);
}
...
...
@@ -519,7 +527,7 @@ void
initintSet
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
1
$"
;
char
*
rev
=
"$Revision: 1.
2
$"
;
UNLESS
(
ExtensionClassImported
)
return
;
...
...
@@ -558,6 +566,9 @@ initintSet()
Revision Log:
$Log: intSet.c,v $
Revision 1.2 1997/09/08 18:41:59 jim
Added logic to save data in binary form.
Revision 1.1 1997/08/05 14:55:22 jim
*** empty log message ***
...
...
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