Skip to content
Snippets Groups Projects
Commit 3e33a501 authored by Craig Tiller's avatar Craig Tiller
Browse files

Use a simpler growth algorithm

parent 9dd49e66
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* in the documentation and/or other materials provided with the * in the documentation and/or other materials provided with the
* distribution. * distribution.
* * Neither the name of Google Inc. nor the names of its * * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from * contributors may be used to endorse or promote products derived from
* this software without specific prior written permission. * this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
...@@ -189,7 +189,7 @@ void gpr_strvec_destroy(gpr_strvec *sv) { ...@@ -189,7 +189,7 @@ void gpr_strvec_destroy(gpr_strvec *sv) {
void gpr_strvec_add(gpr_strvec *sv, char *str) { void gpr_strvec_add(gpr_strvec *sv, char *str) {
if (sv->count == sv->capacity) { if (sv->count == sv->capacity) {
sv->capacity = GPR_MAX(sv->capacity + 8, sv->capacity * 3 / 2); sv->capacity = GPR_MAX(sv->capacity + 8, sv->capacity * 2);
sv->strs = gpr_realloc(sv->strs, sizeof(char*) * sv->capacity); sv->strs = gpr_realloc(sv->strs, sizeof(char*) * sv->capacity);
} }
sv->strs[sv->count++] = str; sv->strs[sv->count++] = str;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment