[Mesa-dev] [PATCH mesa] util: remove unnecessary random whitespaces

Ian Romanick idr at freedesktop.org
Wed Oct 24 20:42:09 UTC 2018


On 10/23/2018 04:15 AM, Eric Engestrom wrote:
> Suggested-by: Timothy Arceri <tarceri at itsqueeze.com>
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
> ---
> Timothy, I opted to remove them all instead of adding even more, as it
> would break again next time something changes (the set_foreach() one was
> already broken before my patch for instance) and result in lots of
> unnecessary churn for seemingly no gain, and I don't like hiding the
> backslash away (it hinders readability).

NAK... we use this formatting everywhere in Mesa.  The point is to move
the \ characters out of the way.  When you're trying to read a
multi-line macro, they are distracting, so it is nice to move them over.

> ---
>  src/util/hash_table.h | 6 +++---
>  src/util/set.h        | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/util/hash_table.h b/src/util/hash_table.h
> index b96cd6146960a6a6f8a1..b9c9dfa01aeaa5e9cac1 100644
> --- a/src/util/hash_table.h
> +++ b/src/util/hash_table.h
> @@ -139,9 +139,9 @@ _mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t size)
>   * an entry's data with the deleted marker), but not against insertion
>   * (which may rehash the table, making entry a dangling pointer).
>   */
> -#define hash_table_foreach(ht, entry)                   \
> -   for (struct hash_entry *entry = _mesa_hash_table_next_entry(ht, NULL);  \
> -        entry != NULL;                                  \
> +#define hash_table_foreach(ht, entry) \
> +   for (struct hash_entry *entry = _mesa_hash_table_next_entry(ht, NULL); \
> +        entry != NULL; \
>          entry = _mesa_hash_table_next_entry(ht, entry))
>  
>  static inline void
> diff --git a/src/util/set.h b/src/util/set.h
> index 3c9abfe77128292557ec..4307f4732fd4fde132a0 100644
> --- a/src/util/set.h
> +++ b/src/util/set.h
> @@ -96,9 +96,9 @@ _mesa_set_random_entry(struct set *set,
>   * insertion (which may rehash the set, making entry a dangling
>   * pointer).
>   */
> -#define set_foreach(set, entry)                          \
> -   for (struct set_entry *entry = _mesa_set_next_entry(set, NULL);  \
> -        entry != NULL;                                   \
> +#define set_foreach(set, entry) \
> +   for (struct set_entry *entry = _mesa_set_next_entry(set, NULL); \
> +        entry != NULL; \
>          entry = _mesa_set_next_entry(set, entry))
>  
>  #ifdef __cplusplus
> 



More information about the mesa-dev mailing list