- (djm) [defines.h sshbuf.c] Move __predict_true|false to defines.h and

conditionalise to avoid duplicate definition.
This commit is contained in:
Damien Miller 2014-09-03 05:33:25 +10:00
parent 41c8de2c00
commit 23f269562b
3 changed files with 16 additions and 11 deletions

View File

@ -1,3 +1,7 @@
20140903
- (djm) [defines.h sshbuf.c] Move __predict_true|false to defines.h and
conditionalise to avoid duplicate definition.
20140830
- (djm) [openbsd-compat/openssl-compat.h] add
OPENSSL_[RD]SA_MAX_MODULUS_BITS defines for OpenSSL that lacks them

View File

@ -25,7 +25,7 @@
#ifndef _DEFINES_H
#define _DEFINES_H
/* $Id: defines.h,v 1.182 2014/06/16 12:50:56 dtucker Exp $ */
/* $Id: defines.h,v 1.183 2014/09/02 19:33:26 djm Exp $ */
/* Constants */
@ -830,4 +830,15 @@ struct winsize {
# endif
#endif
#ifndef __predict_true
# if defined(__GNUC__) && \
((__GNUC__ > (2)) || (__GNUC__ == (2) && __GNUC_MINOR__ >= (96)))
# define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
# define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
# else
# define __predict_true(exp) ((exp) != 0)
# define __predict_false(exp) ((exp) != 0)
# endif /* gcc version */
#endif /* __predict_true */
#endif /* _DEFINES_H */

View File

@ -28,16 +28,6 @@
#include "ssherr.h"
#include "sshbuf.h"
/* XXX move to defines.h? */
#if defined(__GNUC__) && \
((__GNUC__ > (2)) || (__GNUC__ == (2) && __GNUC_MINOR__ >= (96)))
#define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
#define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
#else
#define __predict_true(exp) ((exp) != 0)
#define __predict_false(exp) ((exp) != 0)
#endif
static inline int
sshbuf_check_sanity(const struct sshbuf *buf)
{