Re: [PATCH v4 02/13] column: add API to print items in columns
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 3, 2012, 22:55 UTC
- Message-ID
- <7vehubmsrf.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1328276078-27955-3-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 14 quoted lines
> +struct string_list_item *add_cell_to_list(struct string_list *list,
> + int mode,
> + const char *string)
> +{
> + if (mode & COL_ENABLED)
> + return string_list_append(list, string);
> + return NULL;
> +}
> +
> +void print_cell(struct string_list *list, int mode, const char *string)
> +{
> + if (!add_cell_to_list(list, mode, string))
> + printf("%s\n", string);
> +}I find these two functions showing an extremely bad taste in the code design. "If we for some reason fail to add the string to the list, we fallback to print it straight away" is the natural reading of this code, but that is absolutly not the impression the author of this piece of crap^Wcode wanted to give to its readers.
Am I being too ascestically perfectionist?