*/
/* make sure we have a working area */
- if (NULL == *area) {
+ if (!*area) {
retval = target_alloc_working_area(target, size, area);
if (retval != ERROR_OK) {
LOG_DEBUG("%s: no %d byte buffer", __func__, (int) size);
unsigned found = 0;
struct nand_device *nand;
- for (nand = nand_devices; NULL != nand; nand = nand->next) {
+ for (nand = nand_devices; nand; nand = nand->next) {
if (strcmp(nand->name, name) == 0)
return nand;
if (!flash_driver_name_matches(nand->controller->name, name))
unsigned found = 0;
struct flash_bank *bank;
- for (bank = flash_banks; NULL != bank; bank = bank->next) {
+ for (bank = flash_banks; bank; bank = bank->next) {
if (strcmp(bank->name, name) == 0)
return bank;
if (!flash_driver_name_matches(bank->driver->name, name))
void *buf_cpy(const void *from, void *_to, unsigned size)
{
- if (NULL == from || NULL == _to)
+ if (!from || !_to)
return NULL;
/* copy entire buffer */
return ERROR_COMMAND_SYNTAX_ERROR;
command_print(CMD, "The following debug adapters are available:");
- for (unsigned i = 0; NULL != adapter_drivers[i]; i++) {
+ for (unsigned i = 0; adapter_drivers[i]; i++) {
const char *name = adapter_drivers[i]->name;
command_print(CMD, "%u: %s", i + 1, name);
}
if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0')
return ERROR_COMMAND_SYNTAX_ERROR;
- for (unsigned i = 0; NULL != adapter_drivers[i]; i++) {
+ for (unsigned i = 0; adapter_drivers[i]; i++) {
if (strcmp(CMD_ARGV[0], adapter_drivers[i]->name) != 0)
continue;
- if (NULL != adapter_drivers[i]->commands) {
+ if (adapter_drivers[i]->commands) {
retval = register_commands(CMD_CTX, NULL,
adapter_drivers[i]->commands);
if (retval != ERROR_OK)
struct jtag_command **last_cmd = next_command_pointer;
assert(last_cmd);
- assert(NULL == *last_cmd);
+ assert(!*last_cmd);
*last_cmd = cmd;
/* store location where the next command pointer will be stored */
char desc_string[256];
int retval;
- if (NULL != versaloon_interface.usb_setting.serialstring) {
+ if (versaloon_interface.usb_setting.serialstring) {
retval = libusb_get_string_descriptor_ascii(usb_device_handle,
usb_desc->iSerialNumber, (unsigned char *)desc_string,
sizeof(desc_string));
{
int result;
- if (NULL == xds110.dev || NULL == buffer || NULL == bytes_read)
+ if (!xds110.dev || !buffer || !bytes_read)
return false;
/* Force a non-zero timeout to prevent blocking */
int result = LIBUSB_SUCCESS;
int retries = 0;
- if (NULL == xds110.dev || NULL == buffer)
+ if (!xds110.dev || !buffer)
return false;
result = libusb_bulk_transfer(xds110.dev, xds110.endpoint_out, buffer,
bool success;
- if (NULL == dap_requests || NULL == dap_results)
+ if (!dap_requests || !dap_results)
return false;
xds110.write_payload[0] = OCD_DAP_REQUEST;
bool success;
- if (NULL == scan_requests || NULL == scan_results)
+ if (!scan_requests || !scan_results)
return false;
xds110.write_payload[0] = OCD_SCAN_REQUEST;
&arm_tpiu_swo_register_commands,
NULL
};
- for (unsigned i = 0; NULL != command_registrants[i]; i++) {
+ for (unsigned i = 0; command_registrants[i]; i++) {
int retval = (*command_registrants[i])(cmd_ctx);
if (retval != ERROR_OK) {
command_done(cmd_ctx);
rtos->thread_details[i].exists = true;
/* set thread name */
rtos->thread_details[i].thread_name_str = malloc(strlen((void *)task_name) + 1);
- if (NULL == rtos->thread_details[i].thread_name_str)
+ if (!rtos->thread_details[i].thread_name_str)
return ERROR_FAIL;
strcpy(rtos->thread_details[i].thread_name_str, (void *)task_name);
/* set thread extra info
*/
extra_info_length += strlen((void *)state_name) + 7 + 13 + 8 + 15 + 8;
rtos->thread_details[i].extra_info_str = malloc(extra_info_length + 1);
- if (NULL == rtos->thread_details[i].extra_info_str)
+ if (!rtos->thread_details[i].extra_info_str)
return ERROR_FAIL;
snprintf(rtos->thread_details[i].extra_info_str, extra_info_length,
"State: %s, Address: 0x%" PRIx32 ", Error Code: %" PRIu32,
static int mqx_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
*symbol_list = calloc(ARRAY_SIZE(mqx_symbol_list), sizeof(struct symbol_table_elem));
- if (NULL == *symbol_list)
+ if (!*symbol_list)
return ERROR_FAIL;
/* export required symbols */
for (int i = 0; i < (int)(ARRAY_SIZE(mqx_symbol_list)); i++)
{
int new_byte_len = (new_bit_len + 7) >> 3;
- if ((NULL == *arr) || (((orig_bit_len + 7) >> 3) < ((new_bit_len + 7) >> 3))) {
+ if ((!*arr) || (((orig_bit_len + 7) >> 3) < ((new_bit_len + 7) >> 3))) {
free(*arr);
*arr = calloc(1, new_byte_len);
- if (NULL == *arr) {
+ if (!*arr) {
LOG_ERROR("not enough memory");
return ERROR_FAIL;
}
return JIM_ERR;
}
Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));
- for (unsigned x = 0; NULL != target_types[x]; x++) {
+ for (unsigned x = 0; target_types[x]; x++) {
Jim_ListAppendElement(interp, Jim_GetResult(interp),
Jim_NewStringObj(interp, target_types[x]->name, -1));
}