diff options
-rw-r--r-- | sys/dev/ic/aic79xx.c | 21 | ||||
-rw-r--r-- | sys/dev/ic/aic7xxx.c | 36 |
2 files changed, 25 insertions, 32 deletions
diff --git a/sys/dev/ic/aic79xx.c b/sys/dev/ic/aic79xx.c index 86ca87d97e3..4b69be13807 100644 --- a/sys/dev/ic/aic79xx.c +++ b/sys/dev/ic/aic79xx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic79xx.c,v 1.33 2006/07/30 13:52:54 krw Exp $ */ +/* $OpenBSD: aic79xx.c,v 1.34 2006/07/30 14:21:14 krw Exp $ */ /* * Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom @@ -8803,8 +8803,8 @@ ahd_print_register(ahd_reg_parse_entry_t *table, u_int num_entries, const char *name, u_int address, u_int value, u_int *cur_column, u_int wrap_point) { - int printed; u_int printed_mask; + int entry, printed; if (cur_column != NULL && *cur_column >= wrap_point) { printf("\n"); @@ -8817,15 +8817,13 @@ ahd_print_register(ahd_reg_parse_entry_t *table, u_int num_entries, *cur_column += printed; return (printed); } + printed_mask = 0; while (printed_mask != 0xFF) { - int entry; - for (entry = 0; entry < num_entries; entry++) { - if (((value & table[entry].mask) - != table[entry].value) - || ((printed_mask & table[entry].mask) - == table[entry].mask)) + if (((value & table[entry].mask) != table[entry].value) + || ((printed_mask & table[entry].mask) == + table[entry].mask)) continue; printed += printf("%s%s", @@ -8838,12 +8836,11 @@ ahd_print_register(ahd_reg_parse_entry_t *table, u_int num_entries, if (entry >= num_entries) break; } - if (printed_mask != 0) - printed += printf(") "); - else - printed += printf(" "); + + printed += printf("%s", printed_mask == 0 ? " " : ") "); if (cur_column != NULL) *cur_column += printed; + return (printed); } diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c index e5a3237cb4a..7853327eea3 100644 --- a/sys/dev/ic/aic7xxx.c +++ b/sys/dev/ic/aic7xxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx.c,v 1.72 2006/02/06 17:29:10 jmc Exp $ */ +/* $OpenBSD: aic7xxx.c,v 1.73 2006/07/30 14:21:14 krw Exp $ */ /* $NetBSD: aic7xxx.c,v 1.108 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -40,7 +40,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: aic7xxx.c,v 1.72 2006/02/06 17:29:10 jmc Exp $ + * $Id: aic7xxx.c,v 1.73 2006/07/30 14:21:14 krw Exp $ */ /* * Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003 @@ -6537,44 +6537,40 @@ ahc_print_register(ahc_reg_parse_entry_t *table, u_int num_entries, u_int *cur_column, u_int wrap_point) { u_int printed_mask; - char line[1024]; int entry, printed; - line[0] = 0; - printed_mask = 0; - if (cur_column != NULL && *cur_column >= wrap_point) { printf("\n"); *cur_column = 0; } - snprintf(line, sizeof(line), "%s[0x%x]", name, value); - if (table == NULL) - goto done; + printed = printf("%s[0x%x]", name, value); + if (table == NULL) { + printed += printf(" "); + if (cur_column != NULL) + *cur_column += printed; + return (printed); + } + printed_mask = 0; while (printed_mask != 0xFF) { for (entry = 0; entry < num_entries; entry++) { if (((value & table[entry].mask) != table[entry].value) || ((printed_mask & table[entry].mask) == table[entry].mask)) continue; - if (printed_mask == 0) - strlcat(line, ":(", sizeof line); - else - strlcat(line, "|", sizeof line); - strlcat(line, table[entry].name, sizeof line); + + printed += printf("%s%s", + printed_mask == 0 ? ":(" : "|", + table[entry].name); printed_mask |= table[entry].mask; + break; } if (entry >= num_entries) break; } - if (printed_mask != 0) - strlcat(line, ")", sizeof line); - -done: - printf("%s ", line); - printed = strlen(line) + 1; + printed += printf("%s", printed_mask == 0 ? " " : ") "); if (cur_column != NULL) *cur_column += printed; |