Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1192657
| From | ebiederm@xmission.com (Eric W. Biederman) |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] userns: simplify map_id_range_* functions |
| Date | 2015-07-27 06:40 +0200 |
| Message-ID | <pQImK-7Lu-11@gated-at.bofh.it> (permalink) |
| References | <pQjy1-5VO-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Nicolas Iooss <nicolas.iooss_linux@m4x.org> writes: > Functions map_id_range_down, map_id_down and map_id_up all used the > construction: > > if (...) > id = ... > else > id = ... > return id; > > which can be simplified by directly returning the result of the > computations in each branch. > > Moreover as the condition tested whether the "break;" in the previous > for loop was hit, it is simpler to directly compute the result and > return it. It is not a simplification, it is just code motion. Further at least to my eyes adding multiple exit points and setting the same value in two different places actually obscures what the functions are doing. If we could talk about speeding up the performance of the stat system call I think there would be a point in mucking with these functions. As it is I think it is I think merging your patch will just make it more difficult to understand what the code is doing in the future, with no benefit except a reduction in line count. Eric -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] userns: simplify map_id_range_* functions Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2015-07-26 04:10 +0200 Re: [PATCH] userns: simplify map_id_range_* functions ebiederm@xmission.com (Eric W. Biederman) - 2015-07-27 06:40 +0200
csiph-web