MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / w_update_stat_series

Function w_update_stat_series

modules/statistics/statistics.c:1090–1121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1088}
1089
1090static int w_update_stat_series(struct sip_msg *msg, struct stat_series_profile *profile, str *name, int *value)
1091{
1092 unsigned int hentry;
1093 struct stat_series **ss;
1094
1095 if (!profile) {
1096 LM_ERR("profile does not exist!\n");
1097 return -1;
1098 }
1099
1100 hentry = hash_entry(profile->hash, *name);
1101 hash_lock(profile->hash, hentry);
1102 ss = (struct stat_series **)hash_get(profile->hash, hentry, *name);
1103 if (!ss) {
1104 LM_ERR("could not allocate new entry!\n");
1105 goto release_hash;
1106 }
1107 if (*ss == NULL) {
1108 *ss = new_stat_series(profile, name);
1109 if (*ss == NULL) {
1110 LM_ERR("could not create new stat series!\n");
1111 goto release_hash;
1112 }
1113 }
1114 hash_unlock(profile->hash, hentry);
1115
1116 return update_stat_series(*ss, *value)?-1:1;
1117
1118release_hash:
1119 hash_unlock(profile->hash, hentry);
1120 return -1;
1121}

Callers

nothing calls this directly

Calls 3

hash_entryClass · 0.85
new_stat_seriesFunction · 0.85
update_stat_seriesFunction · 0.85

Tested by

no test coverage detected