diff options
author | jsing <> | 2016-11-04 10:50:32 +0000 |
---|---|---|
committer | jsing <> | 2016-11-04 10:50:32 +0000 |
commit | d8daea57d18a9874231c2f5b625ba176d59586b2 (patch) | |
tree | c8adb83828e7bb385b7459bffed33a64f84aabaa /src/lib | |
parent | cb9e8ed1a8668be65950c7b8199c3d769af795be (diff) | |
download | openbsd-d8daea57d18a9874231c2f5b625ba176d59586b2.tar.gz openbsd-d8daea57d18a9874231c2f5b625ba176d59586b2.tar.bz2 openbsd-d8daea57d18a9874231c2f5b625ba176d59586b2.zip |
Rename the internal bio related functions so that they have a common
prefix. Makes the code more readable and removes shadowing.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libtls/tls_bio_cb.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/lib/libtls/tls_bio_cb.c b/src/lib/libtls/tls_bio_cb.c index 28d93a8208..b36018761d 100644 --- a/src/lib/libtls/tls_bio_cb.c +++ b/src/lib/libtls/tls_bio_cb.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_bio_cb.c,v 1.6 2016/11/04 08:17:43 jsing Exp $ */ | 1 | /* $OpenBSD: tls_bio_cb.c,v 1.7 2016/11/04 10:50:32 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016 Tobias Pape <tobias@netshed.de> | 3 | * Copyright (c) 2016 Tobias Pape <tobias@netshed.de> |
4 | * | 4 | * |
@@ -24,12 +24,12 @@ | |||
24 | #include <tls.h> | 24 | #include <tls.h> |
25 | #include "tls_internal.h" | 25 | #include "tls_internal.h" |
26 | 26 | ||
27 | static int write_cb(BIO *b, const char *buf, int num); | 27 | static int bio_cb_write(BIO *b, const char *buf, int num); |
28 | static int read_cb(BIO *b, char *buf, int size); | 28 | static int bio_cb_read(BIO *b, char *buf, int size); |
29 | static int puts_cb(BIO *b, const char *str); | 29 | static int bio_cb_puts(BIO *b, const char *str); |
30 | static long ctrl_cb(BIO *b, int cmd, long num, void *ptr); | 30 | static long bio_cb_ctrl(BIO *b, int cmd, long num, void *ptr); |
31 | static int new_cb(BIO *b); | 31 | static int bio_cb_new(BIO *b); |
32 | static int free_cb(BIO *data); | 32 | static int bio_cb_free(BIO *data); |
33 | 33 | ||
34 | struct bio_cb_st { | 34 | struct bio_cb_st { |
35 | int (*write_cb)(BIO *h, const char *buf, int num, void *cb_arg); | 35 | int (*write_cb)(BIO *h, const char *buf, int num, void *cb_arg); |
@@ -37,21 +37,21 @@ struct bio_cb_st { | |||
37 | void *cb_arg; | 37 | void *cb_arg; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static BIO_METHOD cb_method = { | 40 | static BIO_METHOD bio_cb_method = { |
41 | .type = BIO_TYPE_MEM, | 41 | .type = BIO_TYPE_MEM, |
42 | .name = "libtls_callbacks", | 42 | .name = "libtls_callbacks", |
43 | .bwrite = write_cb, | 43 | .bwrite = bio_cb_write, |
44 | .bread = read_cb, | 44 | .bread = bio_cb_read, |
45 | .bputs = puts_cb, | 45 | .bputs = bio_cb_puts, |
46 | .ctrl = ctrl_cb, | 46 | .ctrl = bio_cb_ctrl, |
47 | .create = new_cb, | 47 | .create = bio_cb_new, |
48 | .destroy = free_cb | 48 | .destroy = bio_cb_free, |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static BIO_METHOD * | 51 | static BIO_METHOD * |
52 | bio_s_cb(void) | 52 | bio_s_cb(void) |
53 | { | 53 | { |
54 | return (&cb_method); | 54 | return (&bio_cb_method); |
55 | } | 55 | } |
56 | 56 | ||
57 | static int | 57 | static int |
@@ -84,7 +84,7 @@ bio_set_cb_arg(BIO *bi, void *cb_arg) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | static int | 86 | static int |
87 | new_cb(BIO *bi) | 87 | bio_cb_new(BIO *bi) |
88 | { | 88 | { |
89 | struct bio_cb_st *bcb; | 89 | struct bio_cb_st *bcb; |
90 | 90 | ||
@@ -101,7 +101,7 @@ new_cb(BIO *bi) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | static int | 103 | static int |
104 | free_cb(BIO *bi) | 104 | bio_cb_free(BIO *bi) |
105 | { | 105 | { |
106 | if (bi == NULL) | 106 | if (bi == NULL) |
107 | return (0); | 107 | return (0); |
@@ -117,30 +117,30 @@ free_cb(BIO *bi) | |||
117 | } | 117 | } |
118 | 118 | ||
119 | static int | 119 | static int |
120 | read_cb(BIO *b, char *buf, int size) | 120 | bio_cb_read(BIO *b, char *buf, int size) |
121 | { | 121 | { |
122 | struct bio_cb_st *bcb = b->ptr; | 122 | struct bio_cb_st *bcb = b->ptr; |
123 | return (bcb->read_cb(b, buf, size, bcb->cb_arg)); | 123 | return (bcb->read_cb(b, buf, size, bcb->cb_arg)); |
124 | } | 124 | } |
125 | 125 | ||
126 | static int | 126 | static int |
127 | write_cb(BIO *b, const char *buf, int num) | 127 | bio_cb_write(BIO *b, const char *buf, int num) |
128 | { | 128 | { |
129 | struct bio_cb_st *bcb = b->ptr; | 129 | struct bio_cb_st *bcb = b->ptr; |
130 | return (bcb->write_cb(b, buf, num, bcb->cb_arg)); | 130 | return (bcb->write_cb(b, buf, num, bcb->cb_arg)); |
131 | } | 131 | } |
132 | 132 | ||
133 | static int | 133 | static int |
134 | puts_cb(BIO *b, const char *str) | 134 | bio_cb_puts(BIO *b, const char *str) |
135 | { | 135 | { |
136 | int n; | 136 | int n; |
137 | 137 | ||
138 | n = strlen(str); | 138 | n = strlen(str); |
139 | return (write_cb(b, str, n)); | 139 | return (bio_cb_write(b, str, n)); |
140 | } | 140 | } |
141 | 141 | ||
142 | static long | 142 | static long |
143 | ctrl_cb(BIO *b, int cmd, long num, void *ptr) | 143 | bio_cb_ctrl(BIO *b, int cmd, long num, void *ptr) |
144 | { | 144 | { |
145 | long ret = 1; | 145 | long ret = 1; |
146 | 146 | ||