mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
ctdb: Reduce indentation in get_tunable_values()
Use an early return tvals; review with "git sh -b". Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
58ec800928
commit
ce3243d7b2
@ -84,24 +84,27 @@ static uint32_t *get_tunable_values(TALLOC_CTX *tmp_ctx,
|
||||
uint32_t *tvals = talloc_zero_array(tmp_ctx, uint32_t, numnodes);
|
||||
char *t = getenv(tunable);
|
||||
|
||||
if (t) {
|
||||
if (strcmp(t, "1") == 0) {
|
||||
for (i=0; i<numnodes; i++) {
|
||||
tvals[i] = 1;
|
||||
}
|
||||
} else {
|
||||
tok = strtok(t, ",");
|
||||
i = 0;
|
||||
while (tok != NULL) {
|
||||
tvals[i] =
|
||||
(uint32_t) strtol(tok, NULL, 0);
|
||||
i++;
|
||||
tok = strtok(NULL, ",");
|
||||
}
|
||||
if (i != numnodes) {
|
||||
fprintf(stderr, "ERROR: Wrong number of values in %s\n", tunable);
|
||||
exit(1);
|
||||
}
|
||||
if (t == NULL) {
|
||||
return tvals;
|
||||
}
|
||||
|
||||
if (strcmp(t, "1") == 0) {
|
||||
for (i = 0; i < numnodes; i++) {
|
||||
tvals[i] = 1;
|
||||
}
|
||||
} else {
|
||||
tok = strtok(t, ",");
|
||||
i = 0;
|
||||
while (tok != NULL) {
|
||||
tvals[i] = (uint32_t)strtol(tok, NULL, 0);
|
||||
i++;
|
||||
tok = strtok(NULL, ",");
|
||||
}
|
||||
if (i != numnodes) {
|
||||
fprintf(stderr,
|
||||
"ERROR: Wrong number of values in %s\n",
|
||||
tunable);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user