]>
git.ipfire.org Git - thirdparty/squid.git/blob - include/util.h
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
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.
16 #include <arpa/inet.h>
19 SQUIDCEXTERN
int tvSubUsec(struct timeval
, struct timeval
);
20 SQUIDCEXTERN
double tvSubDsec(struct timeval
, struct timeval
);
21 SQUIDCEXTERN
void Tolower(char *);
22 #if defined(__cplusplus)
24 * Any code using libstdc++ must have externally resolvable overloads
25 * for void * operator new - which means in the .o for the binary,
26 * or in a shared library. static libs don't propogate the symbol
27 * so, look in the translation unit containing main() in squid
28 * for the extern version in squid
30 #if !defined(_SQUID_EXTERNNEW_)
31 #if defined(__GNUC_STDC_INLINE__) || defined(__GNUC_GNU_INLINE__)
32 #define _SQUID_EXTERNNEW_ extern inline __attribute__((gnu_inline))
34 #define _SQUID_EXTERNNEW_ extern inline
40 SQUIDCEXTERN
time_t parse_iso3307_time(const char *buf
);
42 SQUIDCEXTERN
double xpercent(double part
, double whole
);
43 SQUIDCEXTERN
int xpercentInt(double part
, double whole
);
44 SQUIDCEXTERN
double xdiv(double nom
, double denom
);
46 SQUIDCEXTERN
const char *xitoa(int num
);
47 SQUIDCEXTERN
const char *xint64toa(int64_t num
);
55 /* gb_type operations */
56 #define gb_flush_limit (0x3FFFFFFF)
57 #define gb_inc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; (gb)->count++; }
58 #define gb_incb(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->bytes += delta; }
59 #define gb_incc(gb, delta) { if ((gb)->bytes > gb_flush_limit || delta > gb_flush_limit) gb_flush(gb); (gb)->count+= delta; }
60 extern double gb_to_double(const gb_t
*);
61 SQUIDCEXTERN
const char *double_to_str(char *buf
, int buf_size
, double value
);
62 extern const char *gb_to_str(const gb_t
*);
63 extern void gb_flush(gb_t
*); /* internal, do not use this */
66 * Returns the amount of known allocated memory
68 int statMemoryAccounted(void);
70 SQUIDCEXTERN
unsigned int RoundTo(const unsigned int num
, const unsigned int what
);
72 #endif /* SQUID_UTIL_H */