Rename function pointers to avoid shadowing global declaration
BoringSSL compilation with -Wshadow fails with following error
error: declaration of 'write' shadows a global declaration [-Werror=shadow]
673 | int (*write)(BIO *, const char *, int)) {
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Renamed function pointers to fix this error.
Bug: b:321092852
Change-Id: I94f988e5c12da5eae93f16e6666bc7ab5ca0fc06
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68107
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c
index 7b4e37c..1543b30 100644
--- a/crypto/bio/bio.c
+++ b/crypto/bio/bio.c
@@ -658,38 +658,38 @@
}
int BIO_meth_set_create(BIO_METHOD *method,
- int (*create)(BIO *)) {
- method->create = create;
+ int (*create_func)(BIO *)) {
+ method->create = create_func;
return 1;
}
int BIO_meth_set_destroy(BIO_METHOD *method,
- int (*destroy)(BIO *)) {
- method->destroy = destroy;
+ int (*destroy_func)(BIO *)) {
+ method->destroy = destroy_func;
return 1;
}
int BIO_meth_set_write(BIO_METHOD *method,
- int (*write)(BIO *, const char *, int)) {
- method->bwrite = write;
+ int (*write_func)(BIO *, const char *, int)) {
+ method->bwrite = write_func;
return 1;
}
int BIO_meth_set_read(BIO_METHOD *method,
- int (*read)(BIO *, char *, int)) {
- method->bread = read;
+ int (*read_func)(BIO *, char *, int)) {
+ method->bread = read_func;
return 1;
}
int BIO_meth_set_gets(BIO_METHOD *method,
- int (*gets)(BIO *, char *, int)) {
- method->bgets = gets;
+ int (*gets_func)(BIO *, char *, int)) {
+ method->bgets = gets_func;
return 1;
}
int BIO_meth_set_ctrl(BIO_METHOD *method,
- long (*ctrl)(BIO *, int, long, void *)) {
- method->ctrl = ctrl;
+ long (*ctrl_func)(BIO *, int, long, void *)) {
+ method->ctrl = ctrl_func;
return 1;
}
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index 89cdc86..e061a0f 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -714,33 +714,35 @@
// and returns one. The function should return one on success and zero on
// error.
OPENSSL_EXPORT int BIO_meth_set_create(BIO_METHOD *method,
- int (*create)(BIO *));
+ int (*create_func)(BIO *));
// BIO_meth_set_destroy sets a function to release data associated with a |BIO|
// and returns one. The function's return value is ignored.
OPENSSL_EXPORT int BIO_meth_set_destroy(BIO_METHOD *method,
- int (*destroy)(BIO *));
+ int (*destroy_func)(BIO *));
// BIO_meth_set_write sets the implementation of |BIO_write| for |method| and
// returns one. |BIO_METHOD|s which implement |BIO_write| should also implement
// |BIO_CTRL_FLUSH|. (See |BIO_meth_set_ctrl|.)
OPENSSL_EXPORT int BIO_meth_set_write(BIO_METHOD *method,
- int (*write)(BIO *, const char *, int));
+ int (*write_func)(BIO *, const char *,
+ int));
// BIO_meth_set_read sets the implementation of |BIO_read| for |method| and
// returns one.
OPENSSL_EXPORT int BIO_meth_set_read(BIO_METHOD *method,
- int (*read)(BIO *, char *, int));
+ int (*read_func)(BIO *, char *, int));
// BIO_meth_set_gets sets the implementation of |BIO_gets| for |method| and
// returns one.
OPENSSL_EXPORT int BIO_meth_set_gets(BIO_METHOD *method,
- int (*gets)(BIO *, char *, int));
+ int (*gets_func)(BIO *, char *, int));
// BIO_meth_set_ctrl sets the implementation of |BIO_ctrl| for |method| and
// returns one.
OPENSSL_EXPORT int BIO_meth_set_ctrl(BIO_METHOD *method,
- long (*ctrl)(BIO *, int, long, void *));
+ long (*ctrl_func)(BIO *, int, long,
+ void *));
// BIO_set_data sets custom data on |bio|. It may be retried with
// |BIO_get_data|.