comparison rvinterf/lowlevel/format.c @ 929:ab771ce34fac

rvinterf/lowlevel/format.c: get rid of static fmtbuf
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2023 05:56:08 +0000
parents 65953c172f24
children bb7a03cc1e43
comparison
equal deleted inserted replaced
928:65953c172f24 929:ab771ce34fac
14 extern u_char rxpkt[]; 14 extern u_char rxpkt[];
15 extern size_t rxpkt_len; 15 extern size_t rxpkt_len;
16 16
17 extern void output_cont(); 17 extern void output_cont();
18 18
19 static char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */
20
21 void 19 void
22 print_rv_trace() 20 print_rv_trace()
23 { 21 {
24 int i; 22 int i;
25 char *dp; 23 char fmtbuf[MAX_PKT_FROM_TARGET*4];
24 char *dp = fmtbuf;
26 25
27 dp = fmtbuf;
28 strcpy(dp, "RV "); 26 strcpy(dp, "RV ");
29 dp += 3; 27 dp += 3;
30 /* the SWE static ID is sent MSB first */ 28 /* the SWE static ID is sent MSB first */
31 for (i = 1; i <= 4; i++) { 29 for (i = 1; i <= 4; i++) {
32 sprintf(dp, "%02X", rxpkt[i]); 30 sprintf(dp, "%02X", rxpkt[i]);
41 39
42 void 40 void
43 print_l1_trace() 41 print_l1_trace()
44 { 42 {
45 int i, c; 43 int i, c;
46 char *dp; 44 char fmtbuf[MAX_PKT_FROM_TARGET*4+1];
45 char *dp = fmtbuf;
47 46
48 dp = fmtbuf;
49 strcpy(dp, "L1: "); 47 strcpy(dp, "L1: ");
50 dp += 4; 48 dp += 4;
51 for (i = 1; i < rxpkt_len; i++) { 49 for (i = 1; i < rxpkt_len; i++) {
52 if ((i+1 < rxpkt_len) && 50 if ((i+1 < rxpkt_len) &&
53 (rxpkt[i] == '\r' && rxpkt[i+1] == '\n' || 51 (rxpkt[i] == '\r' && rxpkt[i+1] == '\n' ||
93 } 91 }
94 92
95 void 93 void
96 print_g23_trace() 94 print_g23_trace()
97 { 95 {
96 char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */
97
98 /* messy logic factored out into libg23 */ 98 /* messy logic factored out into libg23 */
99 format_g23_packet(rxpkt, (int)rxpkt_len, fmtbuf); 99 format_g23_packet(rxpkt, (int)rxpkt_len, fmtbuf);
100 output_line(fmtbuf); 100 output_line(fmtbuf);
101 } 101 }
102 102