mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
Style guide & consistency changes. No semantic changes.
This commit is contained in:
parent
4c1f5ecfe3
commit
19717fa33a
2 changed files with 41 additions and 29 deletions
|
@ -157,7 +157,8 @@ static struct key *keyhead = NULL;
|
|||
static int nkeys = 0;
|
||||
static PyThread_type_lock keymutex = NULL;
|
||||
|
||||
static struct key *find_key(int key, void *value)
|
||||
static struct key *
|
||||
find_key(int key, void *value)
|
||||
{
|
||||
struct key *p;
|
||||
long id = PyThread_get_thread_ident();
|
||||
|
@ -180,14 +181,16 @@ static struct key *find_key(int key, void *value)
|
|||
return p;
|
||||
}
|
||||
|
||||
int PyThread_create_key(void)
|
||||
int
|
||||
PyThread_create_key(void)
|
||||
{
|
||||
if (keymutex == NULL)
|
||||
keymutex = PyThread_allocate_lock();
|
||||
return ++nkeys;
|
||||
}
|
||||
|
||||
void PyThread_delete_key(int key)
|
||||
void
|
||||
PyThread_delete_key(int key)
|
||||
{
|
||||
struct key *p, **q;
|
||||
PyThread_acquire_lock(keymutex, 1);
|
||||
|
@ -204,7 +207,8 @@ void PyThread_delete_key(int key)
|
|||
PyThread_release_lock(keymutex);
|
||||
}
|
||||
|
||||
int PyThread_set_key_value(int key, void *value)
|
||||
int
|
||||
PyThread_set_key_value(int key, void *value)
|
||||
{
|
||||
struct key *p = find_key(key, value);
|
||||
if (p == NULL)
|
||||
|
@ -213,7 +217,8 @@ int PyThread_set_key_value(int key, void *value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *PyThread_get_key_value(int key)
|
||||
void *
|
||||
PyThread_get_key_value(int key)
|
||||
{
|
||||
struct key *p = find_key(key, NULL);
|
||||
if (p == NULL)
|
||||
|
@ -222,7 +227,8 @@ void *PyThread_get_key_value(int key)
|
|||
return p->value;
|
||||
}
|
||||
|
||||
void PyThread_delete_key_value(int key)
|
||||
void
|
||||
PyThread_delete_key_value(int key)
|
||||
{
|
||||
long id = PyThread_get_thread_ident();
|
||||
struct key *p, **q;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue