[PATCH v6 1/2] RISC-V: Support Zcmp push/pop instructions.
Kito Cheng
kito.cheng@gmail.com
Thu Feb 1 12:52:23 GMT 2024
> +static bool
> +reglist_lookup (char **s, unsigned *reg_list)
> +{
> + unsigned regno = 0;
> + unsigned regnum = 0;
> + char *reglist = strdup (*s);
char *token;
> + char *regname[3];
> +
> + if (reglist == NULL)
> + goto next;
> +
> + /* Use reglist to judge the reg name use. */
> + reglist = strtok (reglist, "}");
token = strtok (reglist, "}");
You need to keep the original pointer which points to the start of the
space you got, otherwise it will cause problems when you free that.
> + for(reglist = strtok (reglist, ",");reglist;reglist = strtok(NULL, ",")){
for(token = strtok (token, ","); token ;token = strtok (NULL, ",")) {
> + regname[regnum] = reglist;
regname[regnum] = token;
More information about the Binutils
mailing list