lkml.org 
[lkml]   [2012]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRE: [PATCH 2/2] netprio_cgroup: Optimize the priomap copy loop slightly
    Date
    From
    > -	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]);

    David

    \
     
     \ /
      Last update: 2012-09-11 14:22    [W:0.030 / U:0.536 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site