Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1419327 > unrolled thread
| Started by | Alexey Dobriyan <adobriyan@gmail.com> |
|---|---|
| First post | 2016-06-10 14:30 +0200 |
| Last post | 2016-06-10 14:30 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH trivial] include/linux/mempolicy.h: Clean up code Alexey Dobriyan <adobriyan@gmail.com> - 2016-06-10 14:30 +0200
| From | Alexey Dobriyan <adobriyan@gmail.com> |
|---|---|
| Date | 2016-06-10 14:30 +0200 |
| Subject | Re: [PATCH trivial] include/linux/mempolicy.h: Clean up code |
| Message-ID | <rItJv-4w2-1@gated-at.bofh.it> |
On Fri, Jun 10, 2016 at 3:23 PM, Alexey Dobriyan <adobriyan@gmail.com> wrote:
>> Use one return statement instead of multiple statements,
>> since the new return statement is still simple enough.
>
> Multiple statements are very readable exactly
> because one doesn't need to think of negations etc.
>
>> static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
>> {
>> - if (a == b)
>> - return true;
>> - return __mpol_equal(a, b);
>> + return (a == b) || __mpol_equal(a, b);
>> }
>
>
>
>> struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
>> - unsigned long addr);
>> + unsigned long addr);
>
> For prototypes "one line per prototype, no extern" policy should be adopted.
>
>> - if (vma->vm_file &&
>> + return !(vma->vm_file &&
>> gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping))
>> - < policy_zone)
>> - return false;
>> - return true;
>> + < policy_zone);
>
> If you align gfp_zone() call to "if (" then second test
> would even fit into one line!
>
> Who told you that shoving everything into one expression
> makes it easier to understand?
Back to top | Article view | linux.kernel
csiph-web