return (sizeof(iiwidth) / sizeof((iiwidth)[0]));
}
-extern int get_iiwidth(struct mtr_ctl *ctl) {
+extern ATTRIBUTE_CONST int get_iiwidth(int ipinfo_no) {
static const int len = (sizeof(iiwidth) / sizeof((iiwidth)[0]));
- if (ctl->ipinfo_no < len)
- return iiwidth[ctl->ipinfo_no];
- return iiwidth[ctl->ipinfo_no % len];
+ if (ipinfo_no < len)
+ return iiwidth[ipinfo_no];
+ return iiwidth[ipinfo_no % len];
}
extern char *fmt_ipinfo(struct mtr_ctl *ctl, ip_t *addr){
char *ipinfo = get_ipinfo(ctl, addr);
char fmt[8];
- snprintf(fmt, sizeof(fmt), "%s%%-%ds", ctl->ipinfo_no?"":"AS", get_iiwidth(ctl));
+ snprintf(fmt, sizeof(fmt), "%s%%-%ds", ctl->ipinfo_no?"":"AS", get_iiwidth(ctl->ipinfo_no));
snprintf(fmtinfo, sizeof(fmtinfo), fmt, ipinfo?ipinfo:UNKN);
return fmtinfo;
}
extern void asn_close(struct mtr_ctl *ctl);
extern char *fmt_ipinfo(struct mtr_ctl *ctl, ip_t *addr);
extern ATTRIBUTE_CONST size_t get_iiwidth_len(void);
-extern int get_iiwidth(struct mtr_ctl *ctl);
+extern ATTRIBUTE_CONST int get_iiwidth(int ipinfo_no);
extern int is_printii(struct mtr_ctl *ctl);
int padding = 30;
#ifdef HAVE_IPINFO
if (is_printii(ctl))
- padding += get_iiwidth(ctl);
+ padding += get_iiwidth(ctl->ipinfo_no);
#endif
int max_cols = maxx<=SAVED_PINGS+padding ? maxx-padding : SAVED_PINGS;
startstat = padding - 2;
ctl->ipinfo_no %= iiwidth_len;
if (ctl->reportwide) {
len_hosts++; // space
- len_tmp += get_iiwidth(ctl);
+ len_tmp += get_iiwidth(ctl->ipinfo_no);
if (!ctl->ipinfo_no)
len_tmp += 2; // align header: AS
}