diff --git sys/ddb/db_break.c sys/ddb/db_break.c index dfe2f3af912..85354e32987 100644 --- sys/ddb/db_break.c +++ sys/ddb/db_break.c @@ -46,8 +46,8 @@ #define NBREAKPOINTS 100 struct db_breakpoint db_break_table[NBREAKPOINTS]; db_breakpoint_t db_next_free_breakpoint = &db_break_table[0]; -db_breakpoint_t db_free_breakpoints = 0; -db_breakpoint_t db_breakpoint_list = 0; +db_breakpoint_t db_free_breakpoints = NULL; +db_breakpoint_t db_breakpoint_list = NULL; db_breakpoint_t db_breakpoint_alloc(void); void db_breakpoint_free(db_breakpoint_t); @@ -60,13 +60,13 @@ db_breakpoint_alloc(void) { db_breakpoint_t bkpt; - if ((bkpt = db_free_breakpoints) != 0) { + if ((bkpt = db_free_breakpoints) != NULL) { db_free_breakpoints = bkpt->link; return (bkpt); } if (db_next_free_breakpoint == &db_break_table[NBREAKPOINTS]) { db_printf("All breakpoints used.\n"); - return (0); + return (NULL); } bkpt = db_next_free_breakpoint; db_next_free_breakpoint++; @@ -99,7 +99,7 @@ db_set_breakpoint(vaddr_t addr, int count) #endif bkpt = db_breakpoint_alloc(); - if (bkpt == 0) { + if (bkpt == NULL) { db_printf("Too many breakpoints.\n"); return; } @@ -119,14 +119,14 @@ db_delete_breakpoint(vaddr_t addr) db_breakpoint_t bkpt; db_breakpoint_t *prev; - for (prev = &db_breakpoint_list; (bkpt = *prev) != 0; + for (prev = &db_breakpoint_list; (bkpt = *prev) != NULL; prev = &bkpt->link) { if (bkpt->address == addr) { *prev = bkpt->link; break; } } - if (bkpt == 0) { + if (bkpt == NULL) { db_printf("Not set.\n"); return; } @@ -139,11 +139,11 @@ db_find_breakpoint(vaddr_t addr) { db_breakpoint_t bkpt; - for (bkpt = db_breakpoint_list; bkpt != 0; bkpt = bkpt->link) + for (bkpt = db_breakpoint_list; bkpt != NULL; bkpt = bkpt->link) if (bkpt->address == addr) return (bkpt); - return (0); + return (NULL); } int db_breakpoints_inserted = 1; @@ -154,7 +154,8 @@ db_set_breakpoints(void) db_breakpoint_t bkpt; if (!db_breakpoints_inserted) { - for (bkpt = db_breakpoint_list; bkpt != 0; bkpt = bkpt->link) { + for (bkpt = db_breakpoint_list; bkpt != NULL; + bkpt = bkpt->link) { bkpt->bkpt_inst = db_get_value(bkpt->address, BKPT_SIZE, 0); db_put_value(bkpt->address, BKPT_SIZE, @@ -170,7 +171,7 @@ db_clear_breakpoints(void) db_breakpoint_t bkpt; if (db_breakpoints_inserted) { - for (bkpt = db_breakpoint_list; bkpt != 0; bkpt = bkpt->link) + for (bkpt = db_breakpoint_list; bkpt != NULL; bkpt = bkpt->link) db_put_value(bkpt->address, BKPT_SIZE, bkpt->bkpt_inst); db_breakpoints_inserted = 0; } @@ -194,9 +195,9 @@ db_set_temp_breakpoint(vaddr_t addr) #endif bkpt = db_breakpoint_alloc(); - if (bkpt == 0) { + if (bkpt == NULL) { db_printf("Too many breakpoints.\n"); - return (0); + return (NULL); } bkpt->address = addr; @@ -230,7 +231,7 @@ db_list_breakpoints(void) } db_printf(" Count Address\n"); - for (bkpt = db_breakpoint_list; bkpt != 0; bkpt = bkpt->link) { + for (bkpt = db_breakpoint_list; bkpt != NULL; bkpt = bkpt->link) { db_printf(" %5d ", bkpt->init_count); db_printsym(bkpt->address, DB_STGY_PROC, db_printf); db_printf("\n"); diff --git sys/ddb/db_command.c sys/ddb/db_command.c index 57f0b7c1257..0f1d8edecee 100644 --- sys/ddb/db_command.c +++ sys/ddb/db_command.c @@ -148,7 +148,7 @@ db_cmd_search(char *name, struct db_command *table, struct db_command **cmdp) struct db_command *cmd; int result = CMD_NONE; - for (cmd = table; cmd->name != 0; cmd++) { + for (cmd = table; cmd->name != NULL; cmd++) { char *lp = name, *rp = cmd->name; int c; @@ -181,7 +181,7 @@ db_cmd_list(struct db_command *table) { struct db_command *cmd; - for (cmd = table; cmd->name != 0; cmd++) { + for (cmd = table; cmd->name != NULL; cmd++) { db_printf("%-12s", cmd->name); db_end_line(12); } @@ -227,7 +227,7 @@ db_command(struct db_command **last_cmdp, struct db_command *cmd_table) default: break; } - if ((cmd_table = cmd->more) != 0) { + if ((cmd_table = cmd->more) != NULL) { t = db_read_token(); if (t != tIDENT) { db_cmd_list(cmd_table); @@ -280,7 +280,7 @@ db_command(struct db_command **last_cmdp, struct db_command *cmd_table) } } *last_cmdp = cmd; - if (cmd != 0) { + if (cmd != NULL) { /* Execute the command. */ (*cmd->fcn)(addr, have_addr, count, modif); @@ -581,12 +581,12 @@ struct db_command db_show_cmds[] = { }; struct db_command db_boot_cmds[] = { - { "sync", db_boot_sync_cmd, 0, 0 }, - { "crash", db_boot_crash_cmd, 0, 0 }, - { "dump", db_boot_dump_cmd, 0, 0 }, - { "halt", db_boot_halt_cmd, 0, 0 }, - { "reboot", db_boot_reboot_cmd, 0, 0 }, - { "poweroff", db_boot_poweroff_cmd, 0, 0 }, + { "sync", db_boot_sync_cmd, 0, NULL }, + { "crash", db_boot_crash_cmd, 0, NULL }, + { "dump", db_boot_dump_cmd, 0, NULL }, + { "halt", db_boot_halt_cmd, 0, NULL }, + { "reboot", db_boot_reboot_cmd, 0, NULL }, + { "poweroff", db_boot_poweroff_cmd, 0, NULL }, { NULL, } }; @@ -846,7 +846,7 @@ db_show_regs(db_expr_t addr, int have_addr, db_expr_t count, char *modif) db_format(tmpfmt, sizeof tmpfmt, (long)value, DB_FORMAT_N, 1, sizeof(long) * 3)); db_find_xtrn_sym_and_offset((vaddr_t)value, &name, &offset); - if (name != 0 && offset <= db_maxoff && offset != value) { + if (name != NULL && offset <= db_maxoff && offset != value) { db_printf("\t%s", name); if (offset != 0) db_printf("+%s", diff --git sys/ddb/db_hangman.c sys/ddb/db_hangman.c index e73bd032f1a..3c298d2c323 100644 --- sys/ddb/db_hangman.c +++ sys/ddb/db_hangman.c @@ -100,7 +100,7 @@ db_randomsym(size_t *lenp) dfa.cnt = arc4random_uniform(nsyms); db_elf_sym_forall(db_hang_forall, &dfa); - db_symbol_values(dfa.sym, &q, 0); + db_symbol_values(dfa.sym, &q, NULL); /* strlen(q) && ignoring underscores and colons */ for ((*lenp) = 0, p = q; *p; p++) diff --git sys/ddb/db_output.c sys/ddb/db_output.c index d6abed2745b..9d4da2c5720 100644 --- sys/ddb/db_output.c +++ sys/ddb/db_output.c @@ -130,7 +130,7 @@ db_more(void) while (*p) cnputc(*p++); if (quit_output) { - db_error(0); + db_error(NULL); /* NOTREACHED */ } } diff --git sys/ddb/db_watch.c sys/ddb/db_watch.c index cae2307f7d9..b9e96ec0051 100644 --- sys/ddb/db_watch.c +++ sys/ddb/db_watch.c @@ -53,21 +53,21 @@ int db_watchpoints_inserted = 1; #define NWATCHPOINTS 100 struct db_watchpoint db_watch_table[NWATCHPOINTS]; db_watchpoint_t db_next_free_watchpoint = &db_watch_table[0]; -db_watchpoint_t db_free_watchpoints = 0; -db_watchpoint_t db_watchpoint_list = 0; +db_watchpoint_t db_free_watchpoints = NULL; +db_watchpoint_t db_watchpoint_list = NULL; db_watchpoint_t db_watchpoint_alloc(void) { db_watchpoint_t watch; - if ((watch = db_free_watchpoints) != 0) { + if ((watch = db_free_watchpoints) != NULL) { db_free_watchpoints = watch->link; return (watch); } if (db_next_free_watchpoint == &db_watch_table[NWATCHPOINTS]) { db_printf("All watchpoints used.\n"); - return (0); + return (NULL); } watch = db_next_free_watchpoint; db_next_free_watchpoint++; @@ -91,14 +91,14 @@ db_set_watchpoint(vaddr_t addr, vsize_t size) * Should we do anything fancy with overlapping regions? */ - for (watch = db_watchpoint_list; watch != 0; watch = watch->link) + for (watch = db_watchpoint_list; watch != NULL; watch = watch->link) if (watch->loaddr == addr && watch->hiaddr == addr + size) { db_printf("Already set.\n"); return; } watch = db_watchpoint_alloc(); - if (watch == 0) { + if (watch == NULL) { db_printf("Too many watchpoints.\n"); return; } @@ -118,7 +118,7 @@ db_delete_watchpoint(vaddr_t addr) db_watchpoint_t watch; db_watchpoint_t *prev; - for (prev = &db_watchpoint_list; (watch = *prev) != 0; + for (prev = &db_watchpoint_list; (watch = *prev) != NULL; prev = &watch->link) if (watch->loaddr <= addr && addr < watch->hiaddr) { *prev = watch->link; @@ -134,13 +134,13 @@ db_list_watchpoints(void) { db_watchpoint_t watch; - if (db_watchpoint_list == 0) { + if (db_watchpoint_list == NULL) { db_printf("No watchpoints set\n"); return; } db_printf(" Address Size\n"); - for (watch = db_watchpoint_list; watch != 0; watch = watch->link) + for (watch = db_watchpoint_list; watch != NULL; watch = watch->link) db_printf("%8lx %lx\n", watch->loaddr, watch->hiaddr - watch->loaddr); } @@ -184,7 +184,7 @@ db_set_watchpoints(void) db_watchpoint_t watch; if (!db_watchpoints_inserted && db_watchpoint_list != NULL) { - for (watch = db_watchpoint_list; watch != 0; + for (watch = db_watchpoint_list; watch != NULL; watch = watch->link) pmap_protect(pmap_kernel(), trunc_page(watch->loaddr), round_page(watch->hiaddr), PROT_READ);