mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
r12764@catbus: nickm | 2007-05-15 17:17:39 -0400
Enable (and cope with) more GCC 4.2 warnings. svn:r10196
This commit is contained in:
@@ -97,6 +97,7 @@ extern INLINE double U64_TO_DBL(uint64_t x) {
|
||||
#define ATTR_NORETURN __attribute__((noreturn))
|
||||
#define ATTR_PURE __attribute__((pure))
|
||||
#define ATTR_MALLOC __attribute__((malloc))
|
||||
#define ATTR_NORETURN __attribute__((noreturn))
|
||||
#define ATTR_NONNULL(x) __attribute__((nonnull x))
|
||||
/** Macro: Evaluates to <b>exp</b> and hints the compiler that the value
|
||||
* of <b>exp</b> will probably be true. */
|
||||
@@ -108,6 +109,7 @@ extern INLINE double U64_TO_DBL(uint64_t x) {
|
||||
#define ATTR_NORETURN
|
||||
#define ATTR_PURE
|
||||
#define ATTR_MALLOC
|
||||
#define ATTR_NORETURN
|
||||
#define ATTR_NONNULL(x)
|
||||
#define PREDICT_LIKELY(exp) (exp)
|
||||
#define PREDICT_UNLIKELY(exp) (exp)
|
||||
|
||||
@@ -87,7 +87,7 @@ smartlist_ensure_capacity(smartlist_t *sl, int size)
|
||||
int higher = sl->capacity * 2;
|
||||
while (size > higher)
|
||||
higher *= 2;
|
||||
tor_assert(higher > sl->capacity); /* detect overflow */
|
||||
tor_assert(higher > 0); /* detect overflow */
|
||||
sl->capacity = higher;
|
||||
sl->list = tor_realloc(sl->list, sizeof(void*)*sl->capacity);
|
||||
}
|
||||
|
||||
+3
-2
@@ -858,8 +858,9 @@ tv_add(struct timeval *a, const struct timeval *b)
|
||||
void
|
||||
tv_addms(struct timeval *a, long ms)
|
||||
{
|
||||
a->tv_usec += (ms * 1000) % 1000000;
|
||||
a->tv_sec += ((ms * 1000) / 1000000) + (a->tv_usec / 1000000);
|
||||
uint64_t us = ms * 1000;
|
||||
a->tv_usec += us % 1000000;
|
||||
a->tv_sec += (us / 1000000) + (a->tv_usec / 1000000);
|
||||
a->tv_usec %= 1000000;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user