| 507 | } |
| 508 | |
| 509 | static int fixup_stat(void** param) |
| 510 | { |
| 511 | struct stat_param *sp; |
| 512 | str sname, group; |
| 513 | int grp_idx __attribute__((unused)); |
| 514 | |
| 515 | sp = (struct stat_param *)pkg_malloc(sizeof(struct stat_param)); |
| 516 | if (sp==NULL) { |
| 517 | LM_ERR("no more pkg mem (%d)\n", (int)sizeof(struct stat_param)); |
| 518 | return E_OUT_OF_MEM; |
| 519 | } |
| 520 | memset( sp, 0 , sizeof(struct stat_param) ); |
| 521 | |
| 522 | if (resolve_stat((str*)*param, &group, &sname, &grp_idx) != 0) { |
| 523 | return E_CFG; |
| 524 | } |
| 525 | /* text token */ |
| 526 | sp->u.stat = __get_stat(&sname, grp_idx); |
| 527 | if (sp->u.stat) { |
| 528 | /* statistic found */ |
| 529 | sp->type = STAT_PARAM_TYPE_STAT; |
| 530 | } else { |
| 531 | /* stat not found, keep the name for later */ |
| 532 | sp->type = STAT_PARAM_TYPE_NAME; |
| 533 | sp->u.name = *param; |
| 534 | } |
| 535 | |
| 536 | *param = sp; |
| 537 | |
| 538 | return 0; |
| 539 | } |
| 540 | |
| 541 | static int fixup_free_stat(void** param) |
| 542 | { |
nothing calls this directly
no test coverage detected