Use xmalloc rather than malloc
authorAlan Modra <amodra@gmail.com>
Mon, 3 Aug 2020 01:29:38 +0000 (10:59 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 3 Aug 2020 01:29:38 +0000 (10:59 +0930)
As far as I can tell, the following comment is false nowadays.
/* Calls to m-alloc get turned by sed into xm-alloc.  */

Remove it, and call xmalloc.

* ldlex.l (yy_create_string_buffer): Use xmalloc rather than malloc.
* lexsup.c (parse_args): Likewise.

ld/ChangeLog
ld/ldlex.l
ld/lexsup.c

index eeee6d08a6cfbf1008bc149a9ebb22e55e06664c..0a574db7b030332225caf239c7a01f61a2007bef 100644 (file)
@@ -1,3 +1,8 @@
+2020-08-03  Alan Modra  <amodra@gmail.com>
+
+       * ldlex.l (yy_create_string_buffer): Use xmalloc rather than malloc.
+       * lexsup.c (parse_args): Likewise.
+
 2020-08-03  Alan Modra  <amodra@gmail.com>
 
        PR 26328
index 0fcbe84c8b589db28ef9689cda816a7b89d71b6a..4bd523eda65dc2c412931aaaa092b38ded0000e7 100644 (file)
@@ -515,14 +515,13 @@ yy_create_string_buffer (const char *string, size_t size)
 {
   YY_BUFFER_STATE b;
 
-  /* Calls to m-alloc get turned by sed into xm-alloc.  */
-  b = malloc (sizeof (struct yy_buffer_state));
+  b = xmalloc (sizeof (struct yy_buffer_state));
   b->yy_input_file = 0;
   b->yy_buf_size = size;
 
   /* yy_ch_buf has to be 2 characters longer than the size given because
      we need to put in 2 end-of-buffer characters.  */
-  b->yy_ch_buf = malloc ((unsigned) (b->yy_buf_size + 3));
+  b->yy_ch_buf = xmalloc ((size_t) b->yy_buf_size + 3);
 
   b->yy_ch_buf[0] = '\n';
   strcpy (b->yy_ch_buf+1, string);
index 2c2d0fc8ac0c7bec1ff234b3d0ddfa43f4535477..b9cc8a1e957ee70a64101a65c19095a843b0f39a 100644 (file)
@@ -617,7 +617,7 @@ parse_args (unsigned argc, char **argv)
   longopts = (struct option *)
       xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
   really_longopts = (struct option *)
-      malloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));
+      xmalloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));
 
   /* Starting the short option string with '-' is for programs that
      expect options and other ARGV-elements in any order and that care about
This page took 0.030217 seconds and 4 git commands to generate.