Re: [PATCH v6 3/3] bisect--helper: `write_terms` shell function in C
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 23, 2016, 11:07 UTC
- Message-ID
- <alpine.DEB.2.20.1605231301560.4122@virtualbox>
- In-Reply-To
- <CAFZEwPNkPZ6JnzqbTyhYMwEF-hor2rm39NcB84omrh+uCiVPNw@mail.gmail.com>
Hi Pranit,
On Fri, 20 May 2016, Pranit Bauva wrote:
> Frankly, I have no idea what you mean by libification but I will use > error() since efforts for libification have already started.
The term "libification" is frequently used in the Git project: it means to convert code that was formerly used in a standalone program to make it usable as a library function.
The main differences:
- in the standalone program, you can get away with calling die() when anything goes wrong. Not so in a library function: you need to give the caller a chance to fail gracefully, or even to continue.
- in a standalone program, you can be sloppy and "let exit() clean up", i.e. omit free() calls or even close() calls. In library functions, this is not possible.
- in a standalone program, you may mess with the stdio handles. This is an absolute no-go in library functions.
There are other differences, of course. The gist is that you have to be a lot more careful for library functions.
Ciao, Johannes