Use xmalloc rather than malloc

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.
This commit is contained in:
Alan Modra 2020-08-03 10:59:38 +09:30
parent bfd133d0d8
commit ee44c2ac7b
3 changed files with 8 additions and 4 deletions

View 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

View 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);

View 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