Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #387695
| From | Ike Naar <ike@sdf.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: valgrind leak I can't find |
| Date | 2024-08-22 11:41 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <slrnvce8vt.l93.ike@iceland.freeshell.org> (permalink) |
| References | <j8idnQlHTPZXZFv7nZ2dnZfqn_GdnZ2d@brightview.co.uk> |
On 2024-08-22, Mark Summerfield <mark@qtrac.eu> wrote:
> Here is the vec_str_insert() function:
>
> void vec_str_insert(VecStr* vec, int index, char* value) {
> assert_notnull(vec);
> assert_notnull(value);
> if (index == vec->_size) { // add at the end
> vec_str_push(vec, value);
> return;
> }
> assert_valid_index(vec, index);
> if (vec->_size == vec->_cap)
> vec_str_grow(vec);
> for (int i = vec->_size; i > index; --i)
> vec->_values[i] = vec->_values[i - 1];
> vec->_values[index] = value;
> vec->_size++;
> }
Just out of curiosity, why have special code (the vec_str_push part)
for the case index == vec->_size, when the general code (grow, for loop etc.)
would work just fine for that case?
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
valgrind leak I can't find Mark Summerfield <mark@qtrac.eu> - 2024-08-22 08:41 +0000
Re: valgrind leak I can't find Ben Bacarisse <ben@bsb.me.uk> - 2024-08-22 11:40 +0100
Re: valgrind leak I can't find Bart <bc@freeuk.com> - 2024-08-22 12:01 +0100
Re: valgrind leak I can't find Thiago Adams <thiago.adams@gmail.com> - 2024-08-22 08:18 -0300
Re: valgrind leak I can't find Annada Behera <segfault@tilde.green> - 2024-08-22 17:31 +0530
Naming conventions (was Re: valgrind leak I can't find) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-08-22 15:32 +0200
Re: Naming conventions (was Re: valgrind leak I can't find) Thiago Adams <thiago.adams@gmail.com> - 2024-08-22 11:01 -0300
Re: Naming conventions (was Re: valgrind leak I can't find) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-08-23 17:10 +0200
Re: Naming conventions (was Re: valgrind leak I can't find) James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-08-23 11:57 -0400
Re: Naming conventions (was Re: valgrind leak I can't find) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-08-25 18:55 +0200
Re: Naming conventions (was Re: valgrind leak I can't find) James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-08-25 23:47 -0400
Re: valgrind leak I can't find Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> - 2024-08-24 11:47 +0000
Re: valgrind leak I can't find scott@slp53.sl.home (Scott Lurndal) - 2024-08-24 16:48 +0000
Re: valgrind leak I can't find Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-08-24 14:04 -0700
Re: valgrind leak I can't find Ike Naar <ike@sdf.org> - 2024-08-22 11:41 +0000
Re: valgrind leak I can't find Kaz Kylheku <643-408-1753@kylheku.com> - 2024-08-22 15:20 +0000
Re: valgrind leak I can't find Mark Summerfield <mark@qtrac.eu> - 2024-08-22 17:44 +0000
Re: valgrind leak I can't find Kaz Kylheku <643-408-1753@kylheku.com> - 2024-08-22 17:50 +0000
Re: valgrind leak I can't find Bart <bc@freeuk.com> - 2024-08-23 12:18 +0100
Re: valgrind leak I can't find Michael S <already5chosen@yahoo.com> - 2024-08-23 16:26 +0300
Re: valgrind leak I can't find James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-08-23 09:39 -0400
Re: valgrind leak I can't find James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-08-23 10:58 -0400
Re: valgrind leak I can't find scott@slp53.sl.home (Scott Lurndal) - 2024-08-23 13:40 +0000
Re: valgrind leak I can't find David Brown <david.brown@hesbynett.no> - 2024-08-23 15:41 +0200
Re: valgrind leak I can't find James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-08-23 09:39 -0400
csiph-web