Skip to content

Commit

Permalink
Merge pull request #3587 from lemenkov/bool_keywords
Browse files Browse the repository at this point in the history
Both true and false are now reserved words in a modern ANSI C
  • Loading branch information
razvancrainea authored Feb 20, 2025
2 parents 73ab11a + 810b277 commit 495fe32
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions modules/statistics/statistics.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ union stat_series_slot {
unsigned int nr;
} avg;
struct {
unsigned long true;
unsigned long false;
unsigned long t;
unsigned long f;
} perc;
long acc;
};
Expand Down Expand Up @@ -919,8 +919,8 @@ inline static void reset_stat_series_slot(struct stat_series *ss, union stat_ser
ss->cache.acc -= slot->acc;
break;
case STAT_ALG_PERC:
ss->cache.perc.true -= slot->perc.true;
ss->cache.perc.false -= slot->perc.false;
ss->cache.perc.t -= slot->perc.t;
ss->cache.perc.f -= slot->perc.f;
break;
default:
LM_ERR("unknown profile algorithm %d\n", ss->profile->algorithm);
Expand Down Expand Up @@ -984,9 +984,9 @@ static unsigned long get_stat_series(struct stat_series *ss)
ret = ss->cache.acc;
break;
case STAT_ALG_PERC:
total = ss->cache.perc.true + ss->cache.perc.false;
total = ss->cache.perc.t + ss->cache.perc.f;
if (total != 0)
ret = ss->cache.perc.true * ss->profile->factor / total;
ret = ss->cache.perc.t * ss->profile->factor / total;
break;
default:
LM_ERR("unknown profile algorithm %d\n", ss->profile->algorithm);
Expand Down Expand Up @@ -1072,11 +1072,11 @@ static int update_stat_series(struct stat_series *ss, int value)
break;
case STAT_ALG_PERC:
if (value > 0) {
s->perc.true += value;
ss->cache.perc.true += value;
s->perc.t += value;
ss->cache.perc.t += value;
} else {
s->perc.false -= value;
ss->cache.perc.false -= value;
s->perc.f -= value;
ss->cache.perc.f -= value;
}
break;
default:
Expand Down

0 comments on commit 495fe32

Please sign in to comment.