On Wed, Jul 05, 2017 at 04:47:18PM +0700, Nikolay Marchuk wrote:
> >> +void
> >> +set_filters_qualify_mode(struct filter **filters, unsigned int *nfilters)
> >> +{
> >> +  unsigned int i;
> >> +  for (i = 0; i < *nfilters - 1; ++i) {
> >> +          free_filter(*filters + i);
> >> +  }
> >> +  **filters = (*filters)[*nfilters - 1];
> >> +  *filters = xreallocarray(*filters, 1, sizeof(struct filter));
> > I'm pretty sure realloc() can't be expected to be able to handle 
> > re-allocating
> > memory hunk which is provided by pointer not pointing at the beginning
> > of the hunk. IOW, allocators are not expected to work with arbitrary 
> > pointers,
> > only with ones that are returned by those allocators.
> But pointer isn't changed between allocations.
Oops, I misread that part, sorry. It probably would be nice then to rewrite
the previous line as "(*filters)[0] = (*filters)[*nfilters - 1]", so even dumb
people like me don't have an option to miscomprehend that.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to