Skip to content

Commit 2878ad0

Browse files
committed
streams: remove unused tls functions
The implementations of git_openssl_stream_new and git_mbedtls_stream_new have callers protected by #ifdefs and are never called unless compiled in. There's no need for a dummy implementation. Remove them.
1 parent 5d4e1e0 commit 2878ad0

File tree

5 files changed

+12
-42
lines changed

5 files changed

+12
-42
lines changed

src/streams/mbedtls.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -490,23 +490,4 @@ int git_mbedtls_stream_global_init(void)
490490
return 0;
491491
}
492492

493-
int git_mbedtls_stream_new(git_stream **out, const char *host, const char *port)
494-
{
495-
GIT_UNUSED(out);
496-
GIT_UNUSED(host);
497-
GIT_UNUSED(port);
498-
499-
giterr_set(GITERR_SSL, "mbedTLS is not supported in this version");
500-
return -1;
501-
}
502-
503-
int git_mbedtls__set_cert_location(const char *path, int is_dir)
504-
{
505-
GIT_UNUSED(path);
506-
GIT_UNUSED(is_dir);
507-
508-
giterr_set(GITERR_SSL, "mbedTLS is not supported in this version");
509-
return -1;
510-
}
511-
512493
#endif

src/streams/mbedtls.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
extern int git_mbedtls_stream_global_init(void);
1515

16+
#ifdef GIT_MBEDTLS
17+
extern int git_mbedtls__set_cert_location(const char *path, int is_dir);
18+
1619
extern int git_mbedtls_stream_new(git_stream **out, const char *host, const char *port);
1720
extern int git_mbedtls_stream_wrap(git_stream **out, git_stream *in, const char *host);
18-
19-
extern int git_mbedtls__set_cert_location(const char *path, int is_dir);
21+
#endif
2022

2123
#endif

src/streams/openssl.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -799,23 +799,4 @@ int git_openssl_set_locking(void)
799799
return -1;
800800
}
801801

802-
int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
803-
{
804-
GIT_UNUSED(out);
805-
GIT_UNUSED(host);
806-
GIT_UNUSED(port);
807-
808-
giterr_set(GITERR_SSL, "openssl is not supported in this version");
809-
return -1;
810-
}
811-
812-
int git_openssl__set_cert_location(const char *file, const char *path)
813-
{
814-
GIT_UNUSED(file);
815-
GIT_UNUSED(path);
816-
817-
giterr_set(GITERR_SSL, "openssl is not supported in this version");
818-
return -1;
819-
}
820-
821802
#endif

src/streams/openssl.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
extern int git_openssl_stream_global_init(void);
1515

16+
#ifdef GIT_OPENSSL
17+
extern int git_openssl__set_cert_location(const char *file, const char *path);
18+
1619
extern int git_openssl_stream_new(git_stream **out, const char *host, const char *port);
1720
extern int git_openssl_stream_wrap(git_stream **out, git_stream *in, const char *host);
18-
19-
extern int git_openssl__set_cert_location(const char *file, const char *path);
21+
#endif
2022

2123
#endif

src/streams/stransport.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212
#include "git2/sys/stream.h"
1313

14+
#ifdef GIT_SECURE_TRANSPORT
15+
1416
extern int git_stransport_stream_new(git_stream **out, const char *host, const char *port);
1517
extern int git_stransport_stream_wrap(git_stream **out, git_stream *in, const char *host);
1618

1719
#endif
20+
21+
#endif

0 commit comments

Comments
 (0)