forked from auracaster/openocd
Clean up const usage to avoid excessive casting
Don't use const on pointers that hold heap allocated data, because that means functions that free them must cast away the const. Do use const on pointer parameters or fields that needn't be modified. Remove pointer casts that are no longer needed after fixing the constness. Change-Id: I5d206f5019982fd1950bc6d6d07b6062dc24e886 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1668 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
committed by
Spencer Oliver
parent
c044c60121
commit
517ba0690d
@@ -377,7 +377,7 @@ void target_buffer_get_u16_array(struct target *target, const uint8_t *buffer, u
|
||||
}
|
||||
|
||||
/* write a uint32_t array to a buffer in target memory endianness */
|
||||
void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, uint32_t *srcbuf)
|
||||
void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, const uint32_t *srcbuf)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < count; i++)
|
||||
@@ -385,7 +385,7 @@ void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_
|
||||
}
|
||||
|
||||
/* write a uint16_t array to a buffer in target memory endianness */
|
||||
void target_buffer_set_u16_array(struct target *target, uint8_t *buffer, uint32_t count, uint16_t *srcbuf)
|
||||
void target_buffer_set_u16_array(struct target *target, uint8_t *buffer, uint32_t count, const uint16_t *srcbuf)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < count; i++)
|
||||
@@ -4260,11 +4260,10 @@ no_params:
|
||||
n->name);
|
||||
return JIM_ERR;
|
||||
}
|
||||
if (target->variant)
|
||||
free((void *)(target->variant));
|
||||
e = Jim_GetOpt_String(goi, &cp, NULL);
|
||||
if (e != JIM_OK)
|
||||
return e;
|
||||
free(target->variant);
|
||||
target->variant = strdup(cp);
|
||||
} else {
|
||||
if (goi->argc != 0)
|
||||
|
||||
Reference in New Issue
Block a user