/* Get a list of available target registers features. feature_list must
* be freed by caller.
*/
-static int get_reg_features_list(struct target *target, char **feature_list[], int *feature_list_size,
+static int get_reg_features_list(struct target *target, char const **feature_list[], int *feature_list_size,
struct reg **reg_list, int reg_list_size)
{
int tbl_sz = 0;
*/
for (int j = 0; j < (tbl_sz + 1); j++) {
if (!((*feature_list)[j])) {
- (*feature_list)[tbl_sz++] = strdup(reg_list[i]->feature->name);
+ (*feature_list)[tbl_sz++] = reg_list[i]->feature->name;
*feature_list = realloc(*feature_list, sizeof(char *) * (tbl_sz + 1));
(*feature_list)[tbl_sz] = NULL;
break;
int retval = ERROR_OK;
struct reg **reg_list = NULL;
int reg_list_size;
- char **features = NULL;
+ char const **features = NULL;
int feature_list_size = 0;
char *tdesc = NULL;
int pos = 0;
"</target>\n");
error:
-
- /* note: features[] contains (feature_list_size + 1) elements */
- for (int j = feature_list_size; j >= 0; j--)
- free(features[j]);
free(features);
free(reg_list);
int retval = ERROR_OK;
struct reg **reg_list = NULL;
int reg_list_size = 0;
- char **features = NULL;
+ char const **features = NULL;
int feature_list_size = 0;
retval = target_get_gdb_reg_list(target, ®_list,
}
error:
-
- /* note: features[] contains (feature_list_size + 1) elements */
- for (int j = feature_list_size; j >= 0; j--)
- free(features[j]);
free(features);
free(reg_list);