catpoint

simple slides viewer
git clone git://git.2f30.org/catpoint
Log | Files | Refs | README | LICENSE

commit cf2f323461e9d37b8f4e582e5179997850fa41c9
parent b3466cf8c030f7048bccd3b19b13f798291c9935
Author: sin <sin@2f30.org>
Date:   Mon, 29 Jul 2013 15:42:44 +0100

No need to use calloc()

Ignore the 3rd argument to open as well.

Diffstat:
Mcatpoint.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/catpoint.c b/catpoint.c @@ -21,11 +21,13 @@ main(int argc, char *argv[]) argv++; argc--; - p = calloc(argc, sizeof(char *)); + p = malloc(argc * sizeof(*p)); + if (!p) + err(1, "malloc"); /* map files to mem */ for (i = 0; argv[i] != NULL; i++) { - fd = open(argv[i], O_RDONLY, 0); + fd = open(argv[i], O_RDONLY); if (fd == -1) err(1, "open: %s", argv[i]); p[i] = mmap(NULL, 0x1000, PROT_READ, MAP_PRIVATE, fd, 0);