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
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
Boxiang Sun
cython
Commits
1133c6d5
Commit
1133c6d5
authored
Aug 29, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor duplicated code in utility function
parent
d82956a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
Cython/Utility/StringTools.c
Cython/Utility/StringTools.c
+5
-6
No files found.
Cython/Utility/StringTools.c
View file @
1133c6d5
...
@@ -736,10 +736,7 @@ static CYTHON_INLINE int __Pyx_PyByteArray_AppendObject(PyObject* bytearray, PyO
...
@@ -736,10 +736,7 @@ static CYTHON_INLINE int __Pyx_PyByteArray_AppendObject(PyObject* bytearray, PyO
ival
=
0
;
ival
=
0
;
}
else
{
}
else
{
ival
=
((
PyLongObject
*
)
value
)
->
ob_digit
[
0
];
ival
=
((
PyLongObject
*
)
value
)
->
ob_digit
[
0
];
if
(
unlikely
(
ival
>
255
))
{
if
(
unlikely
(
ival
>
255
))
goto
bad_range
;
PyErr_SetString
(
PyExc_ValueError
,
"byte must be in range(0, 256)"
);
return
-
1
;
}
}
}
}
else
}
else
#endif
#endif
...
@@ -750,11 +747,13 @@ static CYTHON_INLINE int __Pyx_PyByteArray_AppendObject(PyObject* bytearray, PyO
...
@@ -750,11 +747,13 @@ static CYTHON_INLINE int __Pyx_PyByteArray_AppendObject(PyObject* bytearray, PyO
if
(
unlikely
((
ival
<
0
)
|
(
ival
>
255
)))
{
if
(
unlikely
((
ival
<
0
)
|
(
ival
>
255
)))
{
if
(
ival
==
-
1
&&
PyErr_Occurred
())
if
(
ival
==
-
1
&&
PyErr_Occurred
())
return
-
1
;
return
-
1
;
PyErr_SetString
(
PyExc_ValueError
,
"byte must be in range(0, 256)"
);
goto
bad_range
;
return
-
1
;
}
}
}
}
return
__Pyx_PyByteArray_Append
(
bytearray
,
ival
);
return
__Pyx_PyByteArray_Append
(
bytearray
,
ival
);
bad_range:
PyErr_SetString
(
PyExc_ValueError
,
"byte must be in range(0, 256)"
);
return
-
1
;
}
}
//////////////////// ByteArrayAppend.proto ////////////////////
//////////////////// ByteArrayAppend.proto ////////////////////
...
...
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