From e5b64c4f193eb01c81b93ec6e27d6d6bddbfd78b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Fri, 3 Jan 2014 22:40:46 +0100 Subject: Get rid of useless casts of xmalloc/realloc return value. --- src/actions.c | 10 +++++----- src/completions.c | 2 +- src/editor.c | 2 +- src/input.c | 4 ++-- src/main.c | 4 ++-- src/number.c | 2 +- src/sbuf.c | 6 +++--- src/screen.c | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/actions.c b/src/actions.c index 886b99a..4d24d75 100644 --- a/src/actions.c +++ b/src/actions.c @@ -575,7 +575,7 @@ add_keybinding (KeySym keysym, int state, char *cmd, rp_keymap *map) { /* double the key table size */ map->actions_size *= 2; - map->actions = (rp_action*) xrealloc (map->actions, sizeof (rp_action) * map->actions_size); + map->actions = xrealloc (map->actions, sizeof (rp_action) * map->actions_size); PRINT_DEBUG (("realloc()ed key_table %d\n", map->actions_size)); } @@ -591,7 +591,7 @@ static void replace_keybinding (rp_action *key_action, char *newcmd) { if (strlen (key_action->data) < strlen (newcmd)) - key_action->data = (char*) realloc (key_action->data, strlen (newcmd) + 1); + key_action->data = realloc (key_action->data, strlen (newcmd) + 1); strcpy (key_action->data, newcmd); } @@ -637,7 +637,7 @@ keymap_new (char *name) map = xmalloc (sizeof (rp_keymap)); map->name = xstrdup (name); map->actions_size = 1; - map->actions = (rp_action*) xmalloc (sizeof (rp_action) * map->actions_size); + map->actions = xmalloc (sizeof (rp_action) * map->actions_size); map->actions_last = 0; return map; @@ -1704,7 +1704,7 @@ exec_completions (char *str) return head; } - partial = (char*)xmalloc (n); + partial = xmalloc (n); /* Read data from the file, split it into lines and store it in a list. */ @@ -2403,7 +2403,7 @@ arg_array (struct list_head *head) int i = 0; struct cmdarg **args, *cur; - args = (struct cmdarg **)xmalloc (sizeof (struct cmdarg *) * (list_size (head) + 1)); + args = xmalloc (sizeof (struct cmdarg *) * (list_size (head) + 1)); list_for_each_entry (cur, head, node) { args[i] = cur; diff --git a/src/completions.c b/src/completions.c index a047a50..483a4d3 100644 --- a/src/completions.c +++ b/src/completions.c @@ -28,7 +28,7 @@ completions_new (completion_fn list_fn) { rp_completions *c; - c = (rp_completions *) xmalloc (sizeof(rp_completions)); + c = xmalloc (sizeof(rp_completions)); INIT_LIST_HEAD (&c->completion_list); c->complete_fn = list_fn; diff --git a/src/editor.c b/src/editor.c index 3dabe89..c0d6918 100644 --- a/src/editor.c +++ b/src/editor.c @@ -111,7 +111,7 @@ input_line_new (char *prompt, char *preinput, int history_id, completion_fn fn) /* Allocate some memory to start with */ line->size = strlen (preinput) + 100; - line->buffer = (char *) xmalloc (line->size); + line->buffer = xmalloc (line->size); /* load in the preinput */ strcpy (line->buffer, preinput); diff --git a/src/input.c b/src/input.c index 240cfed..8bc9de0 100644 --- a/src/input.c +++ b/src/input.c @@ -90,7 +90,7 @@ rp_mask_to_x11_mask (unsigned int mask) /* &syms_per_code); */ /* *n_returned = 0; */ -/* codes = (KeyCode *)xmalloc (sizeof(KeyCode) * n_returned); */ +/* codes = xmalloc (sizeof(KeyCode) * n_returned); */ /* for (code = min_code; code < max_code; code++) */ /* for (code_col = 0; code_col < syms_per_code; code_col++) */ /* { */ @@ -99,7 +99,7 @@ rp_mask_to_x11_mask (unsigned int mask) /* if (sym == s) */ /* { */ /* n_returned++; */ -/* codes = (KeyCode *)xrealloc (sizeof(KeyCode) * n_returned); */ +/* codes = xrealloc (sizeof(KeyCode) * n_returned); */ /* codes[n_returned-1] = code; */ /* } */ /* } */ diff --git a/src/main.c b/src/main.c index f8d3fed..516abd5 100644 --- a/src/main.c +++ b/src/main.c @@ -110,7 +110,7 @@ xvsprintf (char *fmt, va_list ap) /* A reasonable starting value. */ size = strlen (fmt) + 1; - buffer = (char *)xmalloc (size); + buffer = xmalloc (size); while (1) { @@ -148,7 +148,7 @@ xvsprintf (char *fmt, va_list ap) } /* Resize the buffer and try again. */ - buffer = (char *)xrealloc (buffer, size); + buffer = xrealloc (buffer, size); } return xstrdup(""); diff --git a/src/number.c b/src/number.c index 332fb06..c8b508f 100644 --- a/src/number.c +++ b/src/number.c @@ -129,7 +129,7 @@ numset_new (void) { struct numset *ns; - ns = (struct numset *)xmalloc (sizeof (struct numset)); + ns = xmalloc (sizeof (struct numset)); numset_init (ns); return ns; } diff --git a/src/sbuf.c b/src/sbuf.c index d85ed47..77b8a04 100644 --- a/src/sbuf.c +++ b/src/sbuf.c @@ -27,12 +27,12 @@ struct sbuf * sbuf_new (size_t initsz) { - struct sbuf *b = (struct sbuf*) xmalloc (sizeof (struct sbuf)); + struct sbuf *b = xmalloc (sizeof (struct sbuf)); if (initsz < 1) initsz = 1; - b->data = (char*) xmalloc (initsz); + b->data = xmalloc (initsz); b->maxsz = initsz; b->data[0] = '\0'; @@ -73,7 +73,7 @@ sbuf_nconcat (struct sbuf *b, const char *str, int len) if (b->maxsz < minsz) { - b->data = (char*) xrealloc (b->data, minsz); + b->data = xrealloc (b->data, minsz); b->maxsz = minsz; } diff --git a/src/screen.c b/src/screen.c index d843c04..83f0850 100644 --- a/src/screen.c +++ b/src/screen.c @@ -211,7 +211,7 @@ init_screens (int screen_arg, int screen_num) rp_frame_numset = numset_new(); /* Initialize the screens */ - screens = (rp_screen *)xmalloc (sizeof (rp_screen) * num_screens); + screens = xmalloc (sizeof (rp_screen) * num_screens); PRINT_DEBUG (("%d screens.\n", num_screens)); if (screen_arg) -- cgit v1.2.3