Skip to content

Commit 34a2817

Browse files
committed
print: add missing itoa_once
1 parent dd08265 commit 34a2817

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

print.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
static uint8_t curs_row = 0;
1818
static uint8_t curs_col = 0;
1919

20+
static char itoa_fixed[64];
21+
2022
static void move_vga_cursor(uint8_t column, uint8_t row) {
2123
uint16_t pos = (uint16_t)(row * VGA_WIDTH + column);
2224

@@ -87,7 +89,7 @@ void print_string(const char *string) {
8789
move_vga_cursor(curs_col, curs_row);
8890
}
8991

90-
void print_pci_dev(const struct pci_dev* pci_dev){
92+
void print_pci_dev(const struct pci_dev *pci_dev) {
9193
char buf[8];
9294
print_string(itoa(pci_dev->bus, buf, 10));
9395
print_string(":");
@@ -153,3 +155,5 @@ char *itoa(int value, char *str, int base) {
153155
}
154156
return rc;
155157
}
158+
159+
char *itoa_once(int value, int base) { return itoa(value, itoa_fixed, base); }

print.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ struct pci_dev;
55

66
void print_string(const char *string);
77

8-
void print_pci_dev(const struct pci_dev* pci_dev);
8+
void print_pci_dev(const struct pci_dev *pci_dev);
99

1010
void init_output(void);
1111

1212
char *itoa(int value, char *str, int base);
13+
14+
char *itoa_once(int value, int base);

0 commit comments

Comments
 (0)