/* MI Command Set - MI parser.
- Copyright (C) 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 2000-2016 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
return;
}
/* Create the buffer and copy characters in. */
- arg = xmalloc ((len + 1) * sizeof (char));
+ arg = XNEWVEC (char, len + 1);
chp = start;
len = 0;
while (*chp != '\0' && *chp != '"')
chp++;
}
len = chp - start;
- arg = xmalloc ((len + 1) * sizeof (char));
+ arg = XNEWVEC (char, len + 1);
strncpy (arg, start, len);
arg[len] = '\0';
break;
}
}
/* Append arg to argv. */
- argv = xrealloc (argv, (argc + 2) * sizeof (char *));
+ argv = XRESIZEVEC (char *, argv, argc + 2);
argv[argc++] = arg;
argv[argc] = NULL;
}
static void
mi_parse_cleanup (void *arg)
{
- mi_parse_free (arg);
+ mi_parse_free ((struct mi_parse *) arg);
}
struct mi_parse *
/* Find/skip any token and then extract it. */
for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++)
;
- *token = xmalloc (chp - cmd + 1);
+ *token = (char *) xmalloc (chp - cmd + 1);
memcpy (*token, cmd, (chp - cmd));
(*token)[chp - cmd] = '\0';
for (; *chp && !isspace (*chp); chp++)
;
- parse->command = xmalloc (chp - tmp + 1);
+ parse->command = (char *) xmalloc (chp - tmp + 1);
memcpy (parse->command, tmp, chp - tmp);
parse->command[chp - tmp] = '\0';
}