| 1088 | } |
| 1089 | |
| 1090 | static 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 | |
| 1118 | release_hash: |
| 1119 | hash_unlock(profile->hash, hentry); |
| 1120 | return -1; |
| 1121 | } |
nothing calls this directly
no test coverage detected