mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-28 12:06:59 +03:00
Utilise magic memory tree interface
This commit is contained in:
@@ -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, ...);
|
||||
|
||||
|
||||
@@ -104,11 +104,12 @@ static int linuxspi_spi_duplex(const PROGRAMMER *pgm, const unsigned char *tx, u
|
||||
}
|
||||
|
||||
static void linuxspi_setup(PROGRAMMER *pgm) {
|
||||
pgm->cookie = cfg_malloc("linuxspi_setup()", sizeof(struct pdata));
|
||||
pgm->cookie = mmt_malloc(sizeof(struct pdata));
|
||||
}
|
||||
|
||||
static void linuxspi_teardown(PROGRAMMER* pgm) {
|
||||
free(pgm->cookie);
|
||||
mmt_free(pgm->cookie);
|
||||
pgm->cookie = NULL;
|
||||
}
|
||||
|
||||
static int linuxspi_reset_mcu(const PROGRAMMER *pgm, bool active) {
|
||||
@@ -379,7 +380,7 @@ static int linuxspi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) {
|
||||
}
|
||||
|
||||
static int linuxspi_parseexitspecs(PROGRAMMER *pgm, const char *sp) {
|
||||
char *cp, *s, *str = cfg_strdup("linuxspi_parseextitspecs()", sp);
|
||||
char *cp, *s, *str = mmt_strdup(sp);
|
||||
|
||||
s = str;
|
||||
while ((cp = strtok(s, ","))) {
|
||||
@@ -392,11 +393,11 @@ static int linuxspi_parseexitspecs(PROGRAMMER *pgm, const char *sp) {
|
||||
pgm->exit_reset = EXIT_RESET_DISABLED;
|
||||
continue;
|
||||
}
|
||||
free(str);
|
||||
mmt_free(str);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(str);
|
||||
mmt_free(str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user