]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/ax-general.c
Add casts to memory allocation related calls
[thirdparty/binutils-gdb.git] / gdb / ax-general.c
index 8dbe5729c019e30cfced004cc783dd5456d73a69..49afee6c1b980a45566dc0a8df8cc67f0d7fd55c 100644 (file)
@@ -46,15 +46,14 @@ new_agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
   x->len = 0;
   x->size = 1;                 /* Change this to a larger value once
                                   reallocation code is tested.  */
-  x->buf = xmalloc (x->size);
+  x->buf = (unsigned char *) xmalloc (x->size);
 
   x->gdbarch = gdbarch;
   x->scope = scope;
 
   /* Bit vector for registers used.  */
   x->reg_mask_len = 1;
-  x->reg_mask = xmalloc (x->reg_mask_len * sizeof (x->reg_mask[0]));
-  memset (x->reg_mask, 0, x->reg_mask_len * sizeof (x->reg_mask[0]));
+  x->reg_mask = XCNEWVEC (unsigned char, x->reg_mask_len);
 
   x->tracing = 0;
   x->trace_string = 0;
@@ -94,7 +93,7 @@ grow_expr (struct agent_expr *x, int n)
       x->size *= 2;
       if (x->size < x->len + n)
        x->size = x->len + n + 10;
-      x->buf = xrealloc (x->buf, x->size);
+      x->buf = (unsigned char *) xrealloc (x->buf, x->size);
     }
 }
 
@@ -458,9 +457,9 @@ ax_reg_mask (struct agent_expr *ax, int reg)
           /* It's not appropriate to double here.  This isn't a
             string buffer.  */
           int new_len = byte + 1;
-          unsigned char *new_reg_mask = xrealloc (ax->reg_mask,
-                                                 new_len
-                                                 * sizeof (ax->reg_mask[0]));
+          unsigned char *new_reg_mask
+           = XRESIZEVEC (unsigned char, ax->reg_mask, new_len);
+
           memset (new_reg_mask + ax->reg_mask_len, 0,
                  (new_len - ax->reg_mask_len) * sizeof (ax->reg_mask[0]));
           ax->reg_mask_len = new_len;