Re: [PATCH] df: new option: --total (-c) to produce grand total (in the
From:
Andreas Schwab
Subject:
Re: [PATCH] df: new option: --total (-c) to produce grand total (in the same way as du)
Date:
Wed, 03 Sep 2008 11:03:22 +0200
User-agent:
Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux)
Kamil Dudka <address@hidden> writes:
> @@ -247,6 +254,41 @@ df_readable (bool negative, uintmax_t n, char *buf,
> }
> }
>
> +/* Logical equivalence */
> +#define LOG_EQ(a, b) (!(a) == !(b))
> +
> +/* Add integral value while using uintmax_t for value part and separate
> + negation flag. It adds value of SRC and SRC_NEG to DEST and DEST_NEG.
> + The result will be in DEST and DEST_NEG. See df_readable to understand
> + how the negation flag is used. */
> +static void
> +add_uint_with_neg_flag (uintmax_t *dest, bool *dest_neg,
> + uintmax_t src, bool src_neg)
> +{
> + if (LOG_EQ (*dest_neg, src_neg))
Since both arguments are already bool I see no need for LOG_EQ (it's the
only use anyway).
Andreas.
--
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."