- if (has_suffix(key_str, ".type")) {
- cut_suffix(tmp, tmp_size, key_str, ".type");
- } else if (has_suffix(key_str, ".avgcount")) {
- cut_suffix(tmp, tmp_size, key_str, ".avgcount");
- } else if (has_suffix(key_str, ".sum")) {
- cut_suffix(tmp, tmp_size, key_str, ".sum");
- } else if (has_suffix(key_str, ".avgtime")) {
- cut_suffix(tmp, tmp_size, key_str, ".avgtime");
- } else {
- sstrncpy(tmp, key_str, sizeof(tmp));
+ for (size_t i = 0; i < STATIC_ARRAY_SIZE(cut_suffixes); i++) {
+ if (has_suffix(key_str, cut_suffixes[i])) {
+ cut_suffix(tmp, tmp_size, key_str, cut_suffixes[i]);
+ break;
+ }