kernel/sem: Move variable declarations in create_sem_etc closer to use.
No functional change intended.
This commit is contained in:
@@ -468,12 +468,7 @@ haiku_sem_init(kernel_args *args)
|
||||
sem_id
|
||||
create_sem_etc(int32 count, const char* name, team_id owner)
|
||||
{
|
||||
struct sem_entry* sem = NULL;
|
||||
sem_id id = B_NO_MORE_SEMS;
|
||||
char* tempName;
|
||||
size_t nameLength;
|
||||
|
||||
if (sSemsActive == false || sUsedSems == sMaxSems)
|
||||
if (!sSemsActive || sUsedSems == sMaxSems)
|
||||
return B_NO_MORE_SEMS;
|
||||
|
||||
if (name == NULL)
|
||||
@@ -486,9 +481,9 @@ create_sem_etc(int32 count, const char* name, team_id owner)
|
||||
BReference<Team> teamReference(team, true);
|
||||
|
||||
// clone the name
|
||||
nameLength = strlen(name) + 1;
|
||||
size_t nameLength = strlen(name) + 1;
|
||||
nameLength = min_c(nameLength, B_OS_NAME_LENGTH);
|
||||
tempName = (char*)malloc(nameLength);
|
||||
char* tempName = (char*)malloc(nameLength);
|
||||
if (tempName == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
@@ -497,8 +492,9 @@ create_sem_etc(int32 count, const char* name, team_id owner)
|
||||
InterruptsSpinLocker _(&sSemsSpinlock);
|
||||
|
||||
// get the first slot from the free list
|
||||
sem = sFreeSemsHead;
|
||||
if (sem) {
|
||||
struct sem_entry* sem = sFreeSemsHead;
|
||||
sem_id id = B_NO_MORE_SEMS;
|
||||
if (sem != NULL) {
|
||||
// remove it from the free list
|
||||
sFreeSemsHead = sem->u.unused.next;
|
||||
if (!sFreeSemsHead)
|
||||
|
||||
Reference in New Issue
Block a user