From: Felix Janda <felix.janda@posteo.de>
To: kbd@lists.altlinux.org
Subject: [kbd] [PATCH 2/5] setvtrgb: Don't gratuitously use malloc
Date: Wed, 22 Apr 2015 21:06:18 +0200 [thread overview]
Message-ID: <20150422190618.GB3170@euler> (raw)
---
src/setvtrgb.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/setvtrgb.c b/src/setvtrgb.c
index f99badc..b398615 100644
--- a/src/setvtrgb.c
+++ b/src/setvtrgb.c
@@ -11,7 +11,7 @@
#include "nls.h"
#include "version.h"
-static unsigned char *cmap;
+static unsigned char cmap[3 * 16];
/* Standard VGA terminal colors, matching those hardcoded in the Linux kernel's
* drivers/char/vt.c
@@ -71,9 +71,6 @@ parse_file(FILE *fd, const char *filename)
int c;
unsigned int rows, cols, val;
- if ((cmap = calloc(3 * 16, sizeof(unsigned char))) == NULL)
- error(EXIT_FAILURE, errno, "calloc");
-
for (rows = 0; rows < 3; rows++) {
cols = 0;
@@ -148,7 +145,6 @@ main(int argc, char **argv) {
}
set_colormap(cmap);
- free(cmap);
return EXIT_SUCCESS;
}
--
2.0.5
reply other threads:[~2015-04-22 19:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150422190618.GB3170@euler \
--to=felix.janda@posteo.de \
--cc=kbd@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox