mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-16 02:31:06 +00:00
* update.c (parse_op): do not assume default memtype here
* main.c: after locating the part information, determine default memtype for all update options that didn't have a memtype specified; this is "application" for Xmega parts, and "flash" for everything else. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1086 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
19
update.c
19
update.c
@@ -54,17 +54,13 @@ UPDATE * parse_op(char * s)
|
||||
buf[i] = 0;
|
||||
|
||||
if (*p != ':') {
|
||||
upd->memtype = (char *)malloc(strlen("flash")+1);
|
||||
if (upd->memtype == NULL) {
|
||||
outofmem:
|
||||
fprintf(stderr, "%s: out of memory\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(upd->memtype, "flash");
|
||||
upd->memtype = NULL; /* default memtype, "flash", or "application" */
|
||||
upd->op = DEVICE_WRITE;
|
||||
upd->filename = (char *)malloc(strlen(buf) + 1);
|
||||
if (upd->filename == NULL)
|
||||
goto outofmem;
|
||||
if (upd->filename == NULL) {
|
||||
fprintf(stderr, "%s: out of memory\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(upd->filename, buf);
|
||||
upd->format = FMT_AUTO;
|
||||
return upd;
|
||||
@@ -177,7 +173,10 @@ UPDATE * dup_update(UPDATE * upd)
|
||||
|
||||
memcpy(u, upd, sizeof(UPDATE));
|
||||
|
||||
u->memtype = strdup(upd->memtype);
|
||||
if (upd->memtype != NULL)
|
||||
u->memtype = strdup(upd->memtype);
|
||||
else
|
||||
u->memtype = NULL;
|
||||
u->filename = strdup(upd->filename);
|
||||
|
||||
return u;
|
||||
|
||||
Reference in New Issue
Block a user