Messages in this thread | | | Date | Wed, 12 Sep 2012 11:35:24 +0530 | From | "Srivatsa S. Bhat" <> | Subject | Re: [PATCH 2/2] netprio_cgroup: Optimize the priomap copy loop slightly |
| |
On 09/11/2012 05:12 PM, David Laight wrote: >> - for (i = 0; >> - old_priomap && (i < old_priomap->priomap_len); >> - i++) >> - new_priomap->priomap[i] = old_priomap->priomap[i]; >> + if (old_priomap) { >> + old_len = old_priomap->priomap_len; >> + >> + for (i = 0; i < old_len; i++) >> + new_priomap->priomap[i] = old_priomap->priomap[i]; >> + } > > Or: > memcpy(new_priomap->priomap, old_priomap->priomap, > old_priomap->priomap_len * sizeof old_priomap->priomap[0]); >
Ah, indeed that would be better. I'll send out an updated version of the patches. Thanks!
Regards, Srivatsa S. Bhat
| |