* 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:
joerg_wunsch
2012-04-25 16:32:23 +00:00
parent 80dd0439a8
commit 0dd5684041
4 changed files with 46 additions and 10 deletions

View File

@@ -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;