Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
012f1937
Commit
012f1937
authored
May 06, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I was not aware of the offsetof macro
parent
a7f25564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
Cython/Compiler/Buffer.py
Cython/Compiler/Buffer.py
+2
-4
No files found.
Cython/Compiler/Buffer.py
View file @
012f1937
...
@@ -622,7 +622,7 @@ def type_information_code(proto, impl, name, structinfo_name, dtype, maxdepth):
...
@@ -622,7 +622,7 @@ def type_information_code(proto, impl, name, structinfo_name, dtype, maxdepth):
for
f
in
fields
]
for
f
in
fields
]
impl
.
putln
(
"static __Pyx_StructField %s[] = {"
%
structinfo_name
,
safe
=
True
)
impl
.
putln
(
"static __Pyx_StructField %s[] = {"
%
structinfo_name
,
safe
=
True
)
for
f
,
typeinfo
in
zip
(
fields
,
types
):
for
f
,
typeinfo
in
zip
(
fields
,
types
):
impl
.
putln
(
' {&%s, "%s",
__Pyx_FIELD_OFFSET
(%s, %s)},'
%
impl
.
putln
(
' {&%s, "%s",
offsetof
(%s, %s)},'
%
(
typeinfo
,
f
.
name
,
dtype
.
declaration_code
(
""
),
f
.
cname
),
safe
=
True
)
(
typeinfo
,
f
.
name
,
dtype
.
declaration_code
(
""
),
f
.
cname
),
safe
=
True
)
impl
.
putln
(
' {NULL, NULL, 0}'
,
safe
=
True
)
impl
.
putln
(
' {NULL, NULL, 0}'
,
safe
=
True
)
impl
.
putln
(
"};"
,
safe
=
True
)
impl
.
putln
(
"};"
,
safe
=
True
)
...
@@ -702,8 +702,6 @@ static void __Pyx_RaiseBufferFallbackError(void) {
...
@@ -702,8 +702,6 @@ static void __Pyx_RaiseBufferFallbackError(void) {
#
#
# The alignment code is copied from _struct.c in Python.
# The alignment code is copied from _struct.c in Python.
acquire_utility_code
=
UtilityCode
(
proto
=
"""
acquire_utility_code
=
UtilityCode
(
proto
=
"""
#define __Pyx_FIELD_OFFSET(type, field) (size_t)(&((type*)0)->field)
/* Run-time type information about structs used with buffers */
/* Run-time type information about structs used with buffers */
struct __Pyx_StructField_;
struct __Pyx_StructField_;
...
@@ -717,7 +715,7 @@ typedef struct {
...
@@ -717,7 +715,7 @@ typedef struct {
typedef struct __Pyx_StructField_ {
typedef struct __Pyx_StructField_ {
__Pyx_TypeInfo* type;
__Pyx_TypeInfo* type;
const char* name;
const char* name;
size_t offset;
/* __Pyx_FIELD_OFFSET(structtype, field) */
size_t offset;
} __Pyx_StructField;
} __Pyx_StructField;
typedef struct {
typedef struct {
...
...
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