diff options
| author | Paul Eggert | 2013-12-12 19:44:59 -0800 |
|---|---|---|
| committer | Paul Eggert | 2013-12-12 19:44:59 -0800 |
| commit | 11dde529083c0b3df2e8e91913426ed4975b77c3 (patch) | |
| tree | 82ce197d3f169abda09cc1ddd7a0a5d8c14a386e /src | |
| parent | b9e20952ea75d1c82c7d0935004c23e795c67e2f (diff) | |
| download | emacs-11dde529083c0b3df2e8e91913426ed4975b77c3.tar.gz emacs-11dde529083c0b3df2e8e91913426ed4975b77c3.zip | |
* gnutls.c, gnutls.h (emacs_gnutls_record_check_pending):
Return ptrdiff_t, not int, since it's a buffer size.
Reindent/reparen some macros to a more Gnuish style.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/gnutls.c | 2 | ||||
| -rw-r--r-- | src/gnutls.h | 25 |
3 files changed, 26 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7bbcb345a0f..0ffa9af77fc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-12-13 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * gnutls.c, gnutls.h (emacs_gnutls_record_check_pending): | ||
| 4 | Return ptrdiff_t, not int, since it's a buffer size. | ||
| 5 | Reindent/reparen some macros to a more Gnuish style. | ||
| 6 | |||
| 1 | 2013-12-12 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2013-12-12 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | Avoid undefined behavior with huge regexp interval counts. | 9 | Avoid undefined behavior with huge regexp interval counts. |
diff --git a/src/gnutls.c b/src/gnutls.c index 9ea3f59100d..105e5071ed7 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -365,7 +365,7 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) | |||
| 365 | return ret; | 365 | return ret; |
| 366 | } | 366 | } |
| 367 | 367 | ||
| 368 | int | 368 | ptrdiff_t |
| 369 | emacs_gnutls_record_check_pending (gnutls_session_t state) | 369 | emacs_gnutls_record_check_pending (gnutls_session_t state) |
| 370 | { | 370 | { |
| 371 | return fn_gnutls_record_check_pending (state); | 371 | return fn_gnutls_record_check_pending (state); |
diff --git a/src/gnutls.h b/src/gnutls.h index 0f648dbd81c..4adaad4897d 100644 --- a/src/gnutls.h +++ b/src/gnutls.h | |||
| @@ -45,25 +45,38 @@ typedef enum | |||
| 45 | GNUTLS_STAGE_READY | 45 | GNUTLS_STAGE_READY |
| 46 | } gnutls_initstage_t; | 46 | } gnutls_initstage_t; |
| 47 | 47 | ||
| 48 | #define GNUTLS_EMACS_ERROR_NOT_LOADED GNUTLS_E_APPLICATION_ERROR_MIN + 1 | 48 | #define GNUTLS_EMACS_ERROR_NOT_LOADED (GNUTLS_E_APPLICATION_ERROR_MIN + 1) |
| 49 | #define GNUTLS_EMACS_ERROR_INVALID_TYPE GNUTLS_E_APPLICATION_ERROR_MIN | 49 | #define GNUTLS_EMACS_ERROR_INVALID_TYPE GNUTLS_E_APPLICATION_ERROR_MIN |
| 50 | 50 | ||
| 51 | #define GNUTLS_INITSTAGE(proc) (XPROCESS (proc)->gnutls_initstage) | 51 | #define GNUTLS_INITSTAGE(proc) (XPROCESS (proc)->gnutls_initstage) |
| 52 | 52 | ||
| 53 | #define GNUTLS_PROCESS_USABLE(proc) (GNUTLS_INITSTAGE(proc) >= GNUTLS_STAGE_READY) | 53 | #define GNUTLS_PROCESS_USABLE(proc) \ |
| 54 | (GNUTLS_INITSTAGE (proc) >= GNUTLS_STAGE_READY) | ||
| 54 | 55 | ||
| 55 | #define GNUTLS_LOG(level, max, string) do { if (level <= max) { gnutls_log_function (level, "(Emacs) " string); } } while (0) | 56 | #define GNUTLS_LOG(level, max, string) \ |
| 57 | do { \ | ||
| 58 | if ((level) <= (max)) \ | ||
| 59 | gnutls_log_function (level, "(Emacs) " string); \ | ||
| 60 | } while (0) | ||
| 56 | 61 | ||
| 57 | #define GNUTLS_LOG2(level, max, string, extra) do { if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } } while (0) | 62 | #define GNUTLS_LOG2(level, max, string, extra) \ |
| 63 | do { \ | ||
| 64 | if ((level) <= (max)) \ | ||
| 65 | gnutls_log_function2 (level, "(Emacs) " string, extra); \ | ||
| 66 | } while (0) | ||
| 58 | 67 | ||
| 59 | #define GNUTLS_LOG2i(level, max, string, extra) do { if (level <= max) { gnutls_log_function2i (level, "(Emacs) " string, extra); } } while (0) | 68 | #define GNUTLS_LOG2i(level, max, string, extra) \ |
| 69 | do { \ | ||
| 70 | if ((level) <= (max)) \ | ||
| 71 | gnutls_log_function2i (level, "(Emacs) " string, extra); \ | ||
| 72 | } while (0) | ||
| 60 | 73 | ||
| 61 | extern ptrdiff_t | 74 | extern ptrdiff_t |
| 62 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte); | 75 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte); |
| 63 | extern ptrdiff_t | 76 | extern ptrdiff_t |
| 64 | emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte); | 77 | emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte); |
| 65 | 78 | ||
| 66 | extern int emacs_gnutls_record_check_pending (gnutls_session_t state); | 79 | extern ptrdiff_t emacs_gnutls_record_check_pending (gnutls_session_t state); |
| 67 | #ifdef WINDOWSNT | 80 | #ifdef WINDOWSNT |
| 68 | extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); | 81 | extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); |
| 69 | #endif | 82 | #endif |