openocd: fix simple cases of NULL comparison
There are more than 1000 NULL comparisons to be aligned to the coding style. For recurrent NULL comparison it's preferable using trivial scripts in order to minimize the review effort. Patch generated automatically with the command: sed -i PATTERN $(find src/ -type f) where PATTERN is in the list: 's/(\([a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(NULL == \([a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL == \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL == \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL != \([a-z][a-z0-9_]*\))/(\1)/g' 's/(NULL != \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(\1)/g' 's/(NULL != \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(\1)/g' Change-Id: Ida103e325d6d0600fb69c0b7a1557ee969db4417 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6350 Tested-by: jenkins
This commit is contained in:
@@ -1089,12 +1089,12 @@ static int or1k_init_target(struct command_context *cmd_ctx,
|
||||
struct or1k_du *du_core = or1k_to_du(or1k);
|
||||
struct or1k_jtag *jtag = &or1k->jtag;
|
||||
|
||||
if (du_core == NULL) {
|
||||
if (!du_core) {
|
||||
LOG_ERROR("No debug unit selected");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
if (jtag->tap_ip == NULL) {
|
||||
if (!jtag->tap_ip) {
|
||||
LOG_ERROR("No tap selected");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
@@ -1111,7 +1111,7 @@ static int or1k_init_target(struct command_context *cmd_ctx,
|
||||
|
||||
static int or1k_target_create(struct target *target, Jim_Interp *interp)
|
||||
{
|
||||
if (target->tap == NULL)
|
||||
if (!target->tap)
|
||||
return ERROR_FAIL;
|
||||
|
||||
struct or1k_common *or1k = calloc(1, sizeof(struct or1k_common));
|
||||
|
||||
@@ -946,7 +946,7 @@ static int or1k_adv_jtag_write_memory(struct or1k_jtag *jtag_info,
|
||||
struct target *target = jtag_info->target;
|
||||
if ((target->endianness == TARGET_BIG_ENDIAN) && (size != 1)) {
|
||||
t = malloc(count * size * sizeof(uint8_t));
|
||||
if (t == NULL) {
|
||||
if (!t) {
|
||||
LOG_ERROR("Out of memory");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user