Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0b7ef469
Commit
0b7ef469
authored
May 27, 2006
by
Fredrik Lundh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
needforspeed: stringlib refactoring: use find_slice for stringobject
parent
60d8b188
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
Objects/stringobject.c
Objects/stringobject.c
+15
-12
No files found.
Objects/stringobject.c
View file @
0b7ef469
...
...
@@ -1846,32 +1846,35 @@ string_adjust_indices(Py_ssize_t *start, Py_ssize_t *end, Py_ssize_t len)
Py_LOCAL_INLINE
(
Py_ssize_t
)
string_find_internal
(
PyStringObject
*
self
,
PyObject
*
args
,
int
dir
)
{
const
char
*
s
=
PyString_AS_STRING
(
self
),
*
sub
;
Py_ssize_t
len
=
PyString_GET_SIZE
(
self
);
Py_ssize_t
n
,
i
=
0
,
last
=
PY_SSIZE_T_MAX
;
PyObject
*
subobj
;
const
char
*
sub
;
Py_ssize_t
sub_len
;
Py_ssize_t
start
=
0
,
end
=
PY_SSIZE_T_MAX
;
/* XXX ssize_t i */
if
(
!
PyArg_ParseTuple
(
args
,
"O|O&O&:find/rfind/index/rindex"
,
&
subobj
,
_PyEval_SliceIndex
,
&
i
,
_PyEval_SliceIndex
,
&
last
))
if
(
!
PyArg_ParseTuple
(
args
,
"O|O&O&:find/rfind/index/rindex"
,
&
subobj
,
_PyEval_SliceIndex
,
&
start
,
_PyEval_SliceIndex
,
&
end
))
return
-
2
;
if
(
PyString_Check
(
subobj
))
{
sub
=
PyString_AS_STRING
(
subobj
);
n
=
PyString_GET_SIZE
(
subobj
);
sub_le
n
=
PyString_GET_SIZE
(
subobj
);
}
#ifdef Py_USING_UNICODE
else
if
(
PyUnicode_Check
(
subobj
))
return
PyUnicode_Find
((
PyObject
*
)
self
,
subobj
,
i
,
last
,
dir
);
return
PyUnicode_Find
(
(
PyObject
*
)
self
,
subobj
,
start
,
end
,
dir
);
#endif
else
if
(
PyObject_AsCharBuffer
(
subobj
,
&
sub
,
&
n
))
else
if
(
PyObject_AsCharBuffer
(
subobj
,
&
sub
,
&
sub_le
n
))
return
-
2
;
string_adjust_indices
(
&
i
,
&
last
,
len
);
if
(
dir
>
0
)
return
stringlib_find
(
s
+
i
,
last
-
i
,
sub
,
n
,
i
);
return
stringlib_find_slice
(
PyString_AS_STRING
(
self
),
PyString_GET_SIZE
(
self
),
sub
,
sub_len
,
start
,
end
);
else
return
stringlib_rfind
(
s
+
i
,
last
-
i
,
sub
,
n
,
i
);
return
stringlib_rfind_slice
(
PyString_AS_STRING
(
self
),
PyString_GET_SIZE
(
self
),
sub
,
sub_len
,
start
,
end
);
}
...
...
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