Moving the malloc out of loop will make leak to disappear, and
the command might run few jiffie quicker when there are 1+N
arguments.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Solaris lacks err, errx, warn and warnx. This also means the err.h header
doesn't exist. Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* Change indentation to 8 characters and coding style, for better reading the code.
* Add some memory allocation error handling.
* Fix memory leaks. In cases when Ctrl-C is used to exit the program,
'p' cannot be freed, so made it a global var, to share between main()
and sig_handler(). Signal handing is necessary to fix some leaks, so
added a very basic, non invasive, mechanism.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
The function warn() in rev.c is actually duplicate code,
so here we remove it.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>