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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
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
Show 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 @@
...
@@ -10,7 +10,7 @@
static
char
intSet_module_documentation
[]
=
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>
#include <limits.h>
...
@@ -180,22 +180,34 @@ intSet_remove(intSet *self, PyObject *args)
...
@@ -180,22 +180,34 @@ intSet_remove(intSet *self, PyObject *args)
RETURN_NONE
;
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
*
static
PyObject
*
intSet___getstate__
(
intSet
*
self
,
PyObject
*
args
)
intSet___getstate__
(
intSet
*
self
,
PyObject
*
args
)
{
{
PyObject
*
r
,
*
item
;
PyObject
*
r
=
0
;
int
i
,
l
;
int
i
,
l
;
char
*
c
;
INTSET_DATA_TYPE
*
d
;
INTSET_DATA_TYPE
*
d
;
PER_USE_OR_RETURN
(
self
,
NULL
);
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
;
d
=
self
->
data
;
for
(
i
=
0
;
i
<
l
;
i
++
,
*
d
++
)
for
(
i
=
self
->
len
;
--
i
>=
0
;)
{
{
UNLESS
(
item
=
PyInt_FromLong
(
d
[
i
]))
goto
err
;
*
c
++
=
(
int
)(
*
d
&
0xff
);
PyTuple_SET_ITEM
(
r
,
i
,
item
);
*
c
++
=
(
int
)((
*
d
>>
8
)
&
0xff
);
*
c
++
=
(
int
)((
*
d
>>
16
)
&
0xff
);
*
c
++
=
(
int
)((
*
d
>>
24
)
&
0xff
);
}
}
return
PER_RETURN
(
self
,
r
);
return
PER_RETURN
(
self
,
r
);
...
@@ -205,43 +217,39 @@ err:
...
@@ -205,43 +217,39 @@ err:
return
PER_RETURN
(
self
,
NULL
);
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
*
static
PyObject
*
intSet___setstate__
(
intSet
*
self
,
PyObject
*
args
)
intSet___setstate__
(
intSet
*
self
,
PyObject
*
args
)
{
{
PyObject
*
data
,
*
ok
=
0
;
PyObject
*
data
;
int
i
,
l
;
int
i
,
l
,
v
;
char
*
c
;
INTSET_DATA_TYPE
k
;
INTSET_DATA_TYPE
k
;
PER_PREVENT_DEACTIVATION
(
self
);
PER_PREVENT_DEACTIVATION
(
self
);
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
data
))
return
PER_RETURN
(
self
,
NULL
);
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
);
intSet_clear
(
self
,
NULL
);
if
(
l
>
self
->
size
&&
intSet_grow
(
self
,
l
)
<
0
)
if
(
l
>
self
->
size
&&
intSet_grow
(
self
,
l
)
<
0
)
return
PER_RETURN
(
self
,
NULL
);
return
PER_RETURN
(
self
,
NULL
);
PyErr_Clear
();
PyErr_Clear
();
for
(
i
=
l
;
--
i
>=
0
;
)
for
(
i
=
0
;
i
<
l
;
i
++
)
{
{
UNLESS_ASSIGN
(
ok
,
PySequence_GetItem
(
data
,
i
))
v
=
((
int
)(
unsigned
char
)
*
c
++
)
;
return
PER_RETURN
(
self
,
NULL
)
;
v
|=
((
int
)(
unsigned
char
)
*
c
++
)
<<
8
;
k
=
PyInt_AsLong
(
ok
)
;
v
|=
((
int
)(
unsigned
char
)
*
c
++
)
<<
16
;
if
(
k
<
0
&&
PyErr_Occurred
())
return
PER_RETURN
(
self
,
NULL
)
;
v
|=
((
int
)(
unsigned
char
)
*
c
++
)
<<
24
;
self
->
data
[
i
]
=
k
;
self
->
data
[
i
]
=
v
;
}
}
self
->
len
=
l
;
self
->
len
=
l
;
Py_XDECREF
(
ok
);
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
PER_RETURN
(
self
,
Py_None
);
return
PER_RETURN
(
self
,
Py_None
);
}
}
...
@@ -519,7 +527,7 @@ void
...
@@ -519,7 +527,7 @@ void
initintSet
()
initintSet
()
{
{
PyObject
*
m
,
*
d
;
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
1
$"
;
char
*
rev
=
"$Revision: 1.
2
$"
;
UNLESS
(
ExtensionClassImported
)
return
;
UNLESS
(
ExtensionClassImported
)
return
;
...
@@ -558,6 +566,9 @@ initintSet()
...
@@ -558,6 +566,9 @@ initintSet()
Revision Log:
Revision Log:
$Log: intSet.c,v $
$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
Revision 1.1 1997/08/05 14:55:22 jim
*** empty log message ***
*** 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