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
72391309
Commit
72391309
authored
Jan 19, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF Patch #103250, by pj99: Optimize a strspn() out of startup.
Minor startup speedup: avoid a call to strspn().
parent
b4e98d59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
Python/compile.c
Python/compile.c
+21
-4
No files found.
Python/compile.c
View file @
72391309
...
@@ -164,6 +164,26 @@ PyTypeObject PyCode_Type = {
...
@@ -164,6 +164,26 @@ PyTypeObject PyCode_Type = {
#define NAME_CHARS \
#define NAME_CHARS \
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
/* all_name_chars(s): true iff all chars in s are valid NAME_CHARS */
static
int
all_name_chars
(
unsigned
char
*
s
)
{
static
char
ok_name_char
[
256
];
static
unsigned
char
*
name_chars
=
NAME_CHARS
;
if
(
ok_name_char
[
*
name_chars
]
==
0
)
{
unsigned
char
*
p
;
for
(
p
=
name_chars
;
*
p
;
p
++
)
ok_name_char
[
*
p
]
=
1
;
}
while
(
*
s
)
{
if
(
ok_name_char
[
*
s
++
]
==
0
)
return
0
;
}
return
1
;
}
PyCodeObject
*
PyCodeObject
*
PyCode_New
(
int
argcount
,
int
nlocals
,
int
stacksize
,
int
flags
,
PyCode_New
(
int
argcount
,
int
nlocals
,
int
stacksize
,
int
flags
,
PyObject
*
code
,
PyObject
*
consts
,
PyObject
*
names
,
PyObject
*
code
,
PyObject
*
consts
,
PyObject
*
names
,
...
@@ -214,12 +234,9 @@ PyCode_New(int argcount, int nlocals, int stacksize, int flags,
...
@@ -214,12 +234,9 @@ PyCode_New(int argcount, int nlocals, int stacksize, int flags,
/* Intern selected string constants */
/* Intern selected string constants */
for
(
i
=
PyTuple_Size
(
consts
);
--
i
>=
0
;
)
{
for
(
i
=
PyTuple_Size
(
consts
);
--
i
>=
0
;
)
{
PyObject
*
v
=
PyTuple_GetItem
(
consts
,
i
);
PyObject
*
v
=
PyTuple_GetItem
(
consts
,
i
);
char
*
p
;
if
(
!
PyString_Check
(
v
))
if
(
!
PyString_Check
(
v
))
continue
;
continue
;
p
=
PyString_AsString
(
v
);
if
(
!
all_name_chars
((
unsigned
char
*
)
PyString_AsString
(
v
)))
if
(
strspn
(
p
,
NAME_CHARS
)
!=
(
size_t
)
PyString_Size
(
v
))
continue
;
continue
;
PyString_InternInPlace
(
&
PyTuple_GET_ITEM
(
consts
,
i
));
PyString_InternInPlace
(
&
PyTuple_GET_ITEM
(
consts
,
i
));
}
}
...
...
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