uint32_t count;
uint32_t v;
const char *varname;
- uint8_t buffer[4096];
int n, e, retval;
uint32_t i;
/* index counter */
n = 0;
+
+ size_t buffersize = 4096;
+ uint8_t *buffer = malloc(buffersize);
+ if (buffer == NULL)
+ return JIM_ERR;
+
/* assume ok */
e = JIM_OK;
while (len) {
/* Slurp... in buffer size chunks */
count = len; /* in objects.. */
- if (count > (sizeof(buffer)/width)) {
- count = (sizeof(buffer)/width);
+ if (count > (buffersize/width)) {
+ count = (buffersize/width);
}
retval = target_read_memory(target, addr, width, count, buffer);
}
}
+ free(buffer);
+
Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
return JIM_OK;
uint32_t count;
uint32_t v;
const char *varname;
- uint8_t buffer[4096];
int n, e, retval;
uint32_t i;
n = 0;
/* assume ok */
e = JIM_OK;
+
+ size_t buffersize = 4096;
+ uint8_t *buffer = malloc(buffersize);
+ if (buffer == NULL)
+ return JIM_ERR;
+
while (len) {
/* Slurp... in buffer size chunks */
count = len; /* in objects.. */
- if (count > (sizeof(buffer)/width)) {
- count = (sizeof(buffer)/width);
+ if (count > (buffersize/width)) {
+ count = (buffersize/width);
}
v = 0; /* shut up gcc */
}
}
+ free(buffer);
+
Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
return JIM_OK;