mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-24 10:06:25 +03:00
Move remaining memory allocation to mmt_xyz() functions
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
#include "disasm_private.h"
|
||||
@@ -63,7 +64,7 @@ int FixTargetAddress(int Address) {
|
||||
void Register_JumpCall(int From, int To, int Type, unsigned char FunctionCall) {
|
||||
if((cx->dis_opts.Process_Labels == 1) && (cx->dis_opts.Pass == 1)) {
|
||||
JumpCall_Count++;
|
||||
JumpCalls = realloc(JumpCalls, sizeof(struct JumpCall) * (JumpCall_Count));
|
||||
JumpCalls = mmt_realloc(JumpCalls, sizeof(struct JumpCall) * (JumpCall_Count));
|
||||
JumpCalls[JumpCall_Count - 1].From = From;
|
||||
JumpCalls[JumpCall_Count - 1].To = To;
|
||||
JumpCalls[JumpCall_Count - 1].Type = Type;
|
||||
|
||||
@@ -519,6 +519,7 @@ int Tagfile_Process_Data(const char *Bitstream, int Position) {
|
||||
}
|
||||
|
||||
|
||||
// Allocate, copy, append a suffix (H, L, 0...8 or nothing), make upper case and return
|
||||
static char *regname(const char *reg, int suf) {
|
||||
char *ret =
|
||||
suf <= -1? mmt_strdup(reg):
|
||||
@@ -550,7 +551,7 @@ void initRegisters(const AVRPART *p) {
|
||||
|
||||
// Count how many entries are needed
|
||||
for(int i = 0; i< nr; i++)
|
||||
if(rf[i].addr < 0x40)
|
||||
if(rf[i].addr < 0x40 && rf[i].size > 0)
|
||||
nio += rf[i].size;
|
||||
IORegisters = mmt_malloc(nio*sizeof*IORegisters);
|
||||
MemLabels = mmt_malloc(nr*sizeof*MemLabels);
|
||||
@@ -577,7 +578,7 @@ void initRegisters(const AVRPART *p) {
|
||||
IORegisters[nio].Name = regname(rf[i].reg, 'h');
|
||||
IORegisters[nio].Address = rf[i].addr+1;
|
||||
nio++;
|
||||
} else {
|
||||
} else if(rf[i].size > 2) {
|
||||
for(int k = 0; k < rf[i].size; k++) {
|
||||
IORegisters[nio].Name = regname(rf[i].reg, k);
|
||||
IORegisters[nio].Address = rf[i].addr + k;
|
||||
|
||||
Reference in New Issue
Block a user