summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--defines.h13
-rw-r--r--sshbuf.c10
3 files changed, 16 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 97eb0a8c2..128368da4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120140903
2 - (djm) [defines.h sshbuf.c] Move __predict_true|false to defines.h and
3 conditionalise to avoid duplicate definition.
4
120140830 520140830
2 - (djm) [openbsd-compat/openssl-compat.h] add 6 - (djm) [openbsd-compat/openssl-compat.h] add
3 OPENSSL_[RD]SA_MAX_MODULUS_BITS defines for OpenSSL that lacks them 7 OPENSSL_[RD]SA_MAX_MODULUS_BITS defines for OpenSSL that lacks them
diff --git a/defines.h b/defines.h
index f1deafa61..3ac8be987 100644
--- a/defines.h
+++ b/defines.h
@@ -25,7 +25,7 @@
25#ifndef _DEFINES_H 25#ifndef _DEFINES_H
26#define _DEFINES_H 26#define _DEFINES_H
27 27
28/* $Id: defines.h,v 1.182 2014/06/16 12:50:56 dtucker Exp $ */ 28/* $Id: defines.h,v 1.183 2014/09/02 19:33:26 djm Exp $ */
29 29
30 30
31/* Constants */ 31/* Constants */
@@ -830,4 +830,15 @@ struct winsize {
830# endif 830# endif
831#endif 831#endif
832 832
833#ifndef __predict_true
834# if defined(__GNUC__) && \
835 ((__GNUC__ > (2)) || (__GNUC__ == (2) && __GNUC_MINOR__ >= (96)))
836# define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
837# define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
838# else
839# define __predict_true(exp) ((exp) != 0)
840# define __predict_false(exp) ((exp) != 0)
841# endif /* gcc version */
842#endif /* __predict_true */
843
833#endif /* _DEFINES_H */ 844#endif /* _DEFINES_H */
diff --git a/sshbuf.c b/sshbuf.c
index 5df7c9f46..78f5340a1 100644
--- a/sshbuf.c
+++ b/sshbuf.c
@@ -28,16 +28,6 @@
28#include "ssherr.h" 28#include "ssherr.h"
29#include "sshbuf.h" 29#include "sshbuf.h"
30 30
31/* XXX move to defines.h? */
32#if defined(__GNUC__) && \
33 ((__GNUC__ > (2)) || (__GNUC__ == (2) && __GNUC_MINOR__ >= (96)))
34#define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
35#define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
36#else
37#define __predict_true(exp) ((exp) != 0)
38#define __predict_false(exp) ((exp) != 0)
39#endif
40
41static inline int 31static inline int
42sshbuf_check_sanity(const struct sshbuf *buf) 32sshbuf_check_sanity(const struct sshbuf *buf)
43{ 33{