Utilise magic memory tree interface for usbtiny.c

This commit is contained in:
Stefan Rueger
2024-04-19 19:33:39 +01:00
parent 33e7a56b1c
commit c2c1bda3c5
2 changed files with 5 additions and 10 deletions

View File

@@ -44,6 +44,7 @@ extern const char *pgmid; // Programmer -c string
#define mmt_strdup(s) cfg_strdup(__func__, s)
#define mmt_malloc(n) cfg_malloc(__func__, n)
#define mmt_realloc(p, n) cfg_realloc(__func__, p, n)
#define mmt_free(p) free(p)
int avrdude_message2(FILE *fp, int lno, const char *file, const char *func, int msgmode, int msglvl, const char *format, ...);

View File

@@ -76,18 +76,12 @@ struct pdata
// ----------------------------------------------------------------------
static void usbtiny_setup(PROGRAMMER * pgm)
{
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
pmsg_error("out of memory allocating private data\n");
exit(1);
}
memset(pgm->cookie, 0, sizeof(struct pdata));
static void usbtiny_setup(PROGRAMMER *pgm) {
pgm->cookie = mmt_malloc(sizeof(struct pdata));
}
static void usbtiny_teardown(PROGRAMMER * pgm)
{
free(pgm->cookie);
static void usbtiny_teardown(PROGRAMMER *pgm) {
mmt_free(pgm->cookie);
}
// Wrapper for simple usb_control_msg messages