| 1382 | /* Initialize ABFORMAT and USE_ABFORMAT. */ |
| 1383 | |
| 1384 | static void |
| 1385 | abformat_init (void) |
| 1386 | { |
| 1387 | char const *pb[2]; |
| 1388 | for (int recent = 0; recent < 2; recent++) |
| 1389 | pb[recent] = first_percent_b (long_time_format[recent]); |
| 1390 | if (! (pb[0] || pb[1])) |
| 1391 | return; |
| 1392 | |
| 1393 | char abmon[12][ABFORMAT_SIZE]; |
| 1394 | if (! abmon_init (abmon)) |
| 1395 | return; |
| 1396 | |
| 1397 | for (int recent = 0; recent < 2; recent++) |
| 1398 | { |
| 1399 | char const *fmt = long_time_format[recent]; |
| 1400 | for (int i = 0; i < 12; i++) |
| 1401 | { |
| 1402 | char *nfmt = abformat[recent][i]; |
| 1403 | int nbytes; |
| 1404 | |
| 1405 | if (! pb[recent]) |
| 1406 | nbytes = snprintf (nfmt, ABFORMAT_SIZE, "%s", fmt); |
| 1407 | else |
| 1408 | { |
| 1409 | if (! (pb[recent] - fmt <= MIN (ABFORMAT_SIZE, INT_MAX))) |
| 1410 | return; |
| 1411 | int prefix_len = pb[recent] - fmt; |
| 1412 | nbytes = snprintf (nfmt, ABFORMAT_SIZE, "%.*s%s%s", |
| 1413 | prefix_len, fmt, abmon[i], pb[recent] + 2); |
| 1414 | } |
| 1415 | |
| 1416 | if (! (0 <= nbytes && nbytes < ABFORMAT_SIZE)) |
| 1417 | return; |
| 1418 | } |
| 1419 | } |
| 1420 | |
| 1421 | use_abformat = true; |
| 1422 | } |
| 1423 | |
| 1424 | static size_t |
| 1425 | dev_ino_hash (void const *x, size_t table_size) |
no test coverage detected