diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2021-09-06 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2021-09-09 08:01:00 +0000 |
commit | e094270980f1ca8af86a64cee0dbb6f1df670619 (patch) | |
tree | 1471f9586bb9e3d7f5448001353d47e94145a4ae /libasm | |
parent | 02b05e183998943dd5a19ba783b8793e2ab9ab44 (diff) | |
download | elfutils-e094270980f1ca8af86a64cee0dbb6f1df670619.tar.gz |
Remove redundant casts of memory allocating functions returning void *
Return values of functions returning "void *", e.g. calloc, malloc,
realloc, xcalloc, xmalloc, and xrealloc, do not need explicit casts.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Diffstat (limited to 'libasm')
-rw-r--r-- | libasm/ChangeLog | 14 | ||||
-rw-r--r-- | libasm/asm_align.c | 5 | ||||
-rw-r--r-- | libasm/asm_begin.c | 3 | ||||
-rw-r--r-- | libasm/asm_fill.c | 3 | ||||
-rw-r--r-- | libasm/asm_newabssym.c | 2 | ||||
-rw-r--r-- | libasm/asm_newcomsym.c | 2 | ||||
-rw-r--r-- | libasm/asm_newscn.c | 2 | ||||
-rw-r--r-- | libasm/asm_newscngrp.c | 2 | ||||
-rw-r--r-- | libasm/asm_newsubscn.c | 2 | ||||
-rw-r--r-- | libasm/asm_newsym.c | 2 | ||||
-rw-r--r-- | libasm/disasm_begin.c | 2 |
11 files changed, 25 insertions, 14 deletions
diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 85e723e6..c65fd21b 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,17 @@ +2021-09-06 Dmitry V. Levin <ldv@altlinux.org> + + * asm_align.c (__libasm_ensure_section_space): Remove casts of calloc + return values. + * asm_begin.c (asm_begin): Remove cast of malloc return value. + * asm_fill.c (asm_fill): Likewise. + * asm_newabssym.c (asm_newabssym): Likewise. + * asm_newcomsym.c (asm_newcomsym): Likewise. + * asm_newscn.c (asm_newscn): Likewise. + * asm_newscngrp.c (asm_newscngrp): Likewise. + * asm_newsubscn.c (asm_newsubscn): Likewise. + * asm_newsym.c (asm_newsym): Likewise. + * disasm_begin.c (disasm_begin): Likewise. + 2021-04-19 Martin Liska <mliska@suse.cz> * libasmP.h (asm_emit_symbol_p): Use startswith. diff --git a/libasm/asm_align.c b/libasm/asm_align.c index c8c671b2..3a976756 100644 --- a/libasm/asm_align.c +++ b/libasm/asm_align.c @@ -143,8 +143,7 @@ __libasm_ensure_section_space (AsmScn_t *asmscn, size_t len) /* This is the first block. */ size = MAX (2 * len, 960); - asmscn->content = (struct AsmData *) calloc (1, sizeof (struct AsmData) - + size); + asmscn->content = calloc (1, sizeof (struct AsmData) + size); if (asmscn->content == NULL) return -1; @@ -160,7 +159,7 @@ __libasm_ensure_section_space (AsmScn_t *asmscn, size_t len) size = MAX (2 *len, MIN (32768, 2 * asmscn->offset)); - newp = (struct AsmData *) calloc (1, sizeof (struct AsmData) + size); + newp = calloc (1, sizeof (struct AsmData) + size); if (newp == NULL) return -1; diff --git a/libasm/asm_begin.c b/libasm/asm_begin.c index 1df2d4ea..a190202c 100644 --- a/libasm/asm_begin.c +++ b/libasm/asm_begin.c @@ -138,8 +138,7 @@ asm_begin (const char *fname, Ebl *ebl, bool textp) right away. Instead we create a temporary file in the same directory which, if everything goes alright, will replace a possibly existing file with the given name. */ - AsmCtx_t *result - = (AsmCtx_t *) malloc (sizeof (AsmCtx_t) + 2 * fname_len + 9); + AsmCtx_t *result = malloc (sizeof (AsmCtx_t) + 2 * fname_len + 9); if (result == NULL) return NULL; diff --git a/libasm/asm_fill.c b/libasm/asm_fill.c index 62d9d732..783555ee 100644 --- a/libasm/asm_fill.c +++ b/libasm/asm_fill.c @@ -54,8 +54,7 @@ asm_fill (AsmScn_t *asmscn, void *bytes, size_t len) else { /* Allocate appropriate memory. */ - pattern = (struct FillPattern *) malloc (sizeof (struct FillPattern) - + len); + pattern = malloc (sizeof (struct FillPattern) + len); if (pattern == NULL) return -1; diff --git a/libasm/asm_newabssym.c b/libasm/asm_newabssym.c index 34fef3e3..728d6043 100644 --- a/libasm/asm_newabssym.c +++ b/libasm/asm_newabssym.c @@ -71,7 +71,7 @@ asm_newabssym (AsmCtx_t *ctx, const char *name, GElf_Xword size, rwlock_wrlock (ctx->lock); - result = (AsmSym_t *) malloc (sizeof (AsmSym_t)); + result = malloc (sizeof (AsmSym_t)); if (result == NULL) return NULL; diff --git a/libasm/asm_newcomsym.c b/libasm/asm_newcomsym.c index ee3b6966..750a1380 100644 --- a/libasm/asm_newcomsym.c +++ b/libasm/asm_newcomsym.c @@ -71,7 +71,7 @@ asm_newcomsym (AsmCtx_t *ctx, const char *name, GElf_Xword size, rwlock_wrlock (ctx->lock); - result = (AsmSym_t *) malloc (sizeof (AsmSym_t)); + result = malloc (sizeof (AsmSym_t)); if (result == NULL) return NULL; diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c index 7cdf484f..1150015f 100644 --- a/libasm/asm_newscn.c +++ b/libasm/asm_newscn.c @@ -181,7 +181,7 @@ asm_newscn (AsmCtx_t *ctx, const char *scnname, GElf_Word type, rwlock_wrlock (ctx->lock); /* This is a new section. */ - result = (AsmScn_t *) malloc (sizeof (AsmScn_t) + scnname_len); + result = malloc (sizeof (AsmScn_t) + scnname_len); if (result != NULL) { /* Add the name. */ diff --git a/libasm/asm_newscngrp.c b/libasm/asm_newscngrp.c index 80757a9a..0ca87fba 100644 --- a/libasm/asm_newscngrp.c +++ b/libasm/asm_newscngrp.c @@ -57,7 +57,7 @@ asm_newscngrp (AsmCtx_t *ctx, const char *grpname, AsmSym_t *signature, return NULL; } - result = (AsmScnGrp_t *) malloc (sizeof (AsmScnGrp_t) + grpname_len); + result = malloc (sizeof (AsmScnGrp_t) + grpname_len); if (result == NULL) return NULL; diff --git a/libasm/asm_newsubscn.c b/libasm/asm_newsubscn.c index 906240ac..2f2ba78e 100644 --- a/libasm/asm_newsubscn.c +++ b/libasm/asm_newsubscn.c @@ -62,7 +62,7 @@ asm_newsubscn (AsmScn_t *asmscn, unsigned int nr) runp = runp->subnext; } - newp = (AsmScn_t *) malloc (sizeof (AsmScn_t)); + newp = malloc (sizeof (AsmScn_t)); if (newp == NULL) return NULL; diff --git a/libasm/asm_newsym.c b/libasm/asm_newsym.c index 53891668..a89ee129 100644 --- a/libasm/asm_newsym.c +++ b/libasm/asm_newsym.c @@ -73,7 +73,7 @@ asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size, size_t name_len = strlen (name) + 1; - result = (AsmSym_t *) malloc (sizeof (AsmSym_t) + name_len); + result = malloc (sizeof (AsmSym_t) + name_len); if (result == NULL) return NULL; diff --git a/libasm/disasm_begin.c b/libasm/disasm_begin.c index d00852b7..cb10f66e 100644 --- a/libasm/disasm_begin.c +++ b/libasm/disasm_begin.c @@ -49,7 +49,7 @@ disasm_begin (Ebl *ebl, Elf *elf, DisasmGetSymCB_t symcb) return NULL; } - DisasmCtx_t *ctx = (DisasmCtx_t *) malloc (sizeof (DisasmCtx_t)); + DisasmCtx_t *ctx = malloc (sizeof (DisasmCtx_t)); if (ctx == NULL) { __libasm_seterrno (ASM_E_NOMEM); |