aboutsummaryrefslogtreecommitdiff
path: root/gas/sb.c
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde@tbsaunde.org>2016-02-13 22:00:07 -0500
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-03-22 19:06:39 -0400
commit8860a416a2357aa66a03218c6076b95ef8052ccf (patch)
tree496266d5cf13fa6ddd41b8236141e2aca1eef7f1 /gas/sb.c
parent34b9f7292f9c75d09c169a293c1f021eb97517ca (diff)
downloadfsf-binutils-gdb-8860a416a2357aa66a03218c6076b95ef8052ccf.zip
fsf-binutils-gdb-8860a416a2357aa66a03218c6076b95ef8052ccf.tar.gz
fsf-binutils-gdb-8860a416a2357aa66a03218c6076b95ef8052ccf.tar.bz2
replace some raw xmalloc / xrealloc with the XNEW* macros
This increases consistancy of how we allocate memory, and always casting the result to the proper type. It also helps make sure we get any use of sizeof on the result type correct. gas/ChangeLog: 2016-03-22 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * listing.c (listing_message): Use XNEW style allocation macros. * read.c (read_a_source_file): Likewise. (read_symbol_name): Likewise. (s_mri_common): Likewise. (assign_symbol): Likewise. (s_reloc): Likewise. (emit_expr_with_reloc): Likewise. (s_incbin): Likewise. (s_include): Likewise. * sb.c (sb_build): Likewise. (sb_check): Likewise.
Diffstat (limited to 'gas/sb.c')
-rw-r--r--gas/sb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gas/sb.c b/gas/sb.c
index ed471b8..76d555e 100644
--- a/gas/sb.c
+++ b/gas/sb.c
@@ -59,7 +59,7 @@ static void sb_check (sb *, size_t);
void
sb_build (sb *ptr, size_t size)
{
- ptr->ptr = xmalloc (size + 1);
+ ptr->ptr = XNEWVEC (char, size + 1);
ptr->max = size;
ptr->len = 0;
}
@@ -147,7 +147,7 @@ sb_check (sb *ptr, size_t len)
#endif
max -= MALLOC_OVERHEAD + 1;
ptr->max = max;
- ptr->ptr = xrealloc (ptr->ptr, max + 1);
+ ptr->ptr = XRESIZEVEC (char, ptr->ptr, max + 1);
}
}