* [kbd] [PATCH 2/5] setvtrgb: Don't gratuitously use malloc
@ 2015-04-22 19:06 Felix Janda
0 siblings, 0 replies; only message in thread
From: Felix Janda @ 2015-04-22 19:06 UTC (permalink / raw)
To: kbd
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-04-22 19:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22 19:06 [kbd] [PATCH 2/5] setvtrgb: Don't gratuitously use malloc Felix Janda
Linux console tools development discussion
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/kbd/0 kbd/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 kbd kbd/ http://lore.altlinux.org/kbd \
kbd@lists.altlinux.org kbd@lists.altlinux.ru kbd@lists.altlinux.com
public-inbox-index kbd
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.kbd
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git