Skip to content

Commit

Permalink
fix oclint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kodebach committed Oct 2, 2020
1 parent e5a0611 commit bb90d37
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/libs/ease/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ int elektraArrayValidateBaseNameString (const char * baseName)
{
return -1;
}
if (strcmp (current, "#") == 0)

current++;

if (*current == '\0')
{
return 0;
}

current++;
int underscores = 0;
int digits = 0;

Expand All @@ -74,17 +76,18 @@ int elektraArrayValidateBaseNameString (const char * baseName)
digits++;
}

if (underscores != digits - 1 || underscores + digits > ELEKTRA_MAX_ARRAY_SIZE - 2)
bool underscoresCorrect = underscores == digits - 1;
bool totalLengthCorrect = underscores + digits <= ELEKTRA_MAX_ARRAY_SIZE - 2;
bool reachedEnd = *current == '\0' || *current == '/';

if (underscoresCorrect && totalLengthCorrect && reachedEnd)
{
return -1;
return underscores + 1;
}

if (*current != '\0' && *current != '/')
else
{
return -1;
}

return underscores + 1;
}

int elektraReadArrayNumber (const char * baseName, kdb_long_long_t * oldIndex)
Expand Down

0 comments on commit bb90d37

Please sign in to comment.