]>
Commit | Line | Data |
---|---|---|
090089c4 | 1 | /* |
bf95c10a | 2 | * Copyright (C) 1996-2022 The Squid Software Foundation and contributors |
c5dd4956 | 3 | * |
5c193dec AJ |
4 | * Squid software is distributed under GPLv2+ license and includes |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
090089c4 | 7 | */ |
01fe0751 | 8 | |
b5638623 | 9 | #ifndef SQUID_UTIL_H |
10 | #define SQUID_UTIL_H | |
090089c4 | 11 | |
cc192b50 | 12 | #if HAVE_ARPA_INET_H |
13 | #include <arpa/inet.h> | |
14 | #endif | |
090089c4 | 15 | |
e6ccf245 | 16 | SQUIDCEXTERN void Tolower(char *); |
30a4f2a8 | 17 | |
e6ccf245 | 18 | SQUIDCEXTERN double xpercent(double part, double whole); |
19 | SQUIDCEXTERN int xpercentInt(double part, double whole); | |
20 | SQUIDCEXTERN double xdiv(double nom, double denom); | |
7021844c | 21 | |
e6ccf245 | 22 | SQUIDCEXTERN const char *xitoa(int num); |
47f6e231 | 23 | SQUIDCEXTERN const char *xint64toa(int64_t num); |
7021844c | 24 | |
d96ceb8e | 25 | typedef struct { |
26 | size_t count; | |
27 | size_t bytes; | |
28 | size_t gb; | |
29 | } gb_t; | |
30 | ||
31 | /* gb_type operations */ | |
32 | #define gb_flush_limit (0x3FFFFFFF) | |
33 | #define gb_inc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; (gb)->count++; } | |
34 | #define gb_incb(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; } | |
35 | #define gb_incc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->count+= delta; } | |
36 | extern double gb_to_double(const gb_t *); | |
e6ccf245 | 37 | SQUIDCEXTERN const char *double_to_str(char *buf, int buf_size, double value); |
d96ceb8e | 38 | extern const char *gb_to_str(const gb_t *); |
39 | extern void gb_flush(gb_t *); /* internal, do not use this */ | |
40 | ||
43d1bbe4 FC |
41 | SQUIDCEXTERN unsigned int RoundTo(const unsigned int num, const unsigned int what); |
42 | ||
b5638623 | 43 | #endif /* SQUID_UTIL_H */ |
f53969cc | 44 |