str: drop argument checks no caller can trip
sinit's nil and negative-length tests and stoutf's zero-size test only had test callers; every real caller passes a buffer and its size. The len > n check after fullrune succeeded could never fire.
This commit is contained in:
@@ -76,7 +76,6 @@ str_utf8_capacity(struct ct *t)
|
||||
int n;
|
||||
char *want;
|
||||
} cases[] = {
|
||||
{ 0, 0, nil },
|
||||
{ 1, 0, "" },
|
||||
{ 2, 1, "a" },
|
||||
{ 3, 1, "a" },
|
||||
@@ -95,10 +94,6 @@ str_utf8_capacity(struct ct *t)
|
||||
if(n != cases[i].n)
|
||||
CT_ERRORF(t, "size %d: want length %d, got %d",
|
||||
cases[i].size, cases[i].n, n);
|
||||
if(cases[i].size == 0){
|
||||
CT_EQ_INT(t, 'Z', buf[0]);
|
||||
continue;
|
||||
}
|
||||
if(strcmp(cases[i].want, buf) != 0)
|
||||
CT_ERRORF(t, "size %d: want \"%s\", got \"%s\"",
|
||||
cases[i].size, cases[i].want, buf);
|
||||
@@ -120,10 +115,6 @@ str_invalid_and_full_appends(struct ct *t)
|
||||
Str s;
|
||||
int i;
|
||||
|
||||
CT_CHECK(t, !sinit(&s, nil, 1));
|
||||
CT_EQ_INT(t, 0, s.n);
|
||||
CT_CHECK(t, !sinit(&s, "x", -1));
|
||||
CT_EQ_INT(t, 0, s.n);
|
||||
for(i = 0; i < Maxrunes; i++)
|
||||
s.r[i] = 'a';
|
||||
s.n = Maxrunes;
|
||||
|
||||
Reference in New Issue
Block a user