[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torsocks/master] Set hidden visibility to most function calls
commit a87cd2e5800490f2f5123d8b3087db763a1405c8
Author: David Goulet <dgoulet@xxxxxxxxx>
Date: Fri Aug 23 21:35:18 2013 -0400
Set hidden visibility to most function calls
Signed-off-by: David Goulet <dgoulet@xxxxxxxxx>
---
src/common/compat.c | 4 ++--
src/common/compat.h | 6 +-----
src/common/config-file.c | 2 ++
src/common/connection.c | 11 +++++++++++
src/common/ht.h | 5 +++++
src/common/onion.c | 5 +++++
src/common/socks5.c | 9 +++++++++
src/common/utils.c | 1 +
8 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/src/common/compat.c b/src/common/compat.c
index 03f70a8..5e3cf77 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -19,7 +19,7 @@
#include "compat.h"
-#ifdef __linux__
+#if (defined(__linux__) || defined(__FreeBSD__) || defined(__darwin__))
/*
* Initialize a pthread mutex. This never fails.
@@ -71,4 +71,4 @@ void tsocks_mutex_unlock(tsocks_mutex_t *m)
assert(!ret);
}
-#endif /* __linux__ */
+#endif /* __linux__, __darwin__, __FreeBSD__ */
diff --git a/src/common/compat.h b/src/common/compat.h
index 020fe8e..a433339 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -22,10 +22,6 @@
#define RTLD_NEXT ((void *) -1)
-#endif /* __linux__, __FreeBSD__, __darwin__ */
-
-#ifdef __linux__
-
#include <pthread.h>
typedef struct tsocks_mutex_t {
@@ -41,6 +37,6 @@ void tsocks_mutex_destroy(tsocks_mutex_t *m);
void tsocks_mutex_lock(tsocks_mutex_t *m);
void tsocks_mutex_unlock(tsocks_mutex_t *m);
-#endif /* __linux__ */
+#endif /* __linux__, __darwin__, __FreeBSD__ */
#endif /* TORSOCKS_COMPAT_H */
diff --git a/src/common/config-file.c b/src/common/config-file.c
index 32c93ea..39ca792 100644
--- a/src/common/config-file.c
+++ b/src/common/config-file.c
@@ -250,6 +250,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int config_file_read(const char *filename, struct configuration *config)
{
int ret;
@@ -305,6 +306,7 @@ error:
* Free everything inside a configuration file object. It is the caller
* responsability to free the object if needed.
*/
+ATTR_HIDDEN
void config_file_destroy(struct config_file *conf)
{
assert(conf);
diff --git a/src/common/connection.c b/src/common/connection.c
index 52d7acb..ab065b1 100644
--- a/src/common/connection.c
+++ b/src/common/connection.c
@@ -84,6 +84,7 @@ HT_GENERATE(connection_registry, connection, node, conn_hash_fct,
/*
* Acquire connection registry mutex.
*/
+ATTR_HIDDEN
void connection_registry_lock(void)
{
tsocks_mutex_lock(&connection_registry_mutex);
@@ -92,6 +93,7 @@ void connection_registry_lock(void)
/*
* Release connection registry mutex.
*/
+ATTR_HIDDEN
void connection_registry_unlock(void)
{
tsocks_mutex_unlock(&connection_registry_mutex);
@@ -100,6 +102,7 @@ void connection_registry_unlock(void)
/*
* Initialize connection registry.
*/
+ATTR_HIDDEN
void connection_registry_init(void)
{
HT_INIT(connection_registry, &connection_registry_root);
@@ -111,6 +114,7 @@ void connection_registry_init(void)
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int connection_addr_set(enum connection_domain domain, const char *ip,
in_port_t port, struct connection_addr *addr)
{
@@ -170,6 +174,7 @@ error:
*
* Return a newly allocated connection object or else NULL.
*/
+ATTR_HIDDEN
struct connection *connection_create(int fd, const struct sockaddr *dest)
{
struct connection *conn = NULL;
@@ -211,6 +216,7 @@ error:
/*
* Return the matching element with the given key or NULL if not found.
*/
+ATTR_HIDDEN
struct connection *connection_find(int key)
{
struct connection c_tmp;
@@ -222,6 +228,7 @@ struct connection *connection_find(int key)
/*
* Insert a connection object into the hash table.
*/
+ATTR_HIDDEN
void connection_insert(struct connection *conn)
{
struct connection *c_tmp;
@@ -238,6 +245,7 @@ void connection_insert(struct connection *conn)
/*
* Remove a given connection object from the registry.
*/
+ATTR_HIDDEN
void connection_remove(struct connection *conn)
{
assert(conn);
@@ -247,6 +255,7 @@ void connection_remove(struct connection *conn)
/*
* Destroy a connection by freeing its memory.
*/
+ATTR_HIDDEN
void connection_destroy(struct connection *conn)
{
if (!conn) {
@@ -260,6 +269,7 @@ void connection_destroy(struct connection *conn)
/*
* Get a reference of the given connection object.
*/
+ATTR_HIDDEN
void connection_get_ref(struct connection *c)
{
ref_get(&c->refcount);
@@ -269,6 +279,7 @@ void connection_get_ref(struct connection *c)
* Put back a reference of the given connection object. If the refcount drops
* to 0, the release connection function is called which frees the object.
*/
+ATTR_HIDDEN
void connection_put_ref(struct connection *c)
{
ref_put(&c->refcount, release_conn);
diff --git a/src/common/ht.h b/src/common/ht.h
index 9883ea5..e2fb809 100644
--- a/src/common/ht.h
+++ b/src/common/ht.h
@@ -8,6 +8,8 @@
#ifndef HT_H_INCLUDED_
#define HT_H_INCLUDED_
+#include "macros.h"
+
#define HT_HEAD(name, type) \
struct name { \
/* The hash table itself. */ \
@@ -315,6 +317,7 @@ ht_string_hash(const char *s)
/* Expand the internal table of 'head' until it is large enough to \
* hold 'size' elements. Return 0 on success, -1 on allocation \
* failure. */ \
+ ATTR_HIDDEN \
int \
name##_HT_GROW(struct name *head, unsigned size) \
{ \
@@ -377,6 +380,7 @@ ht_string_hash(const char *s)
} \
/* Free all storage held by 'head'. Does not free 'head' itself, or \
* individual elements. */ \
+ ATTR_HIDDEN \
void \
name##_HT_CLEAR(struct name *head) \
{ \
@@ -387,6 +391,7 @@ ht_string_hash(const char *s)
} \
/* Debugging helper: return false iff the representation of 'head' is \
* internally consistent. */ \
+ ATTR_HIDDEN \
int \
name##_HT_REP_IS_BAD_(const struct name *head) \
{ \
diff --git a/src/common/onion.c b/src/common/onion.c
index 8255c89..c34121a 100644
--- a/src/common/onion.c
+++ b/src/common/onion.c
@@ -88,6 +88,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int onion_pool_init(struct onion_pool *pool, in_addr_t addr, uint8_t mask)
{
int ret = 0;
@@ -139,6 +140,7 @@ error:
/*
* Destroy onion pool by freeing every entry.
*/
+ATTR_HIDDEN
void onion_pool_destroy(struct onion_pool *pool)
{
int i;
@@ -160,6 +162,7 @@ void onion_pool_destroy(struct onion_pool *pool)
*
* Return a newly allocated onion entry or else NULL.
*/
+ATTR_HIDDEN
struct onion_entry *onion_entry_create(struct onion_pool *pool,
const char *onion_name)
{
@@ -215,6 +218,7 @@ error:
*
* Return entry on success or else NULL.
*/
+ATTR_HIDDEN
struct onion_entry *onion_entry_find_by_name(const char *onion_name,
struct onion_pool *pool)
{
@@ -245,6 +249,7 @@ end:
*
* Return entry on success or else NULL.
*/
+ATTR_HIDDEN
struct onion_entry *onion_entry_find_by_ip(in_addr_t ip,
struct onion_pool *pool)
{
diff --git a/src/common/socks5.c b/src/common/socks5.c
index f1683c9..fcd48b6 100644
--- a/src/common/socks5.c
+++ b/src/common/socks5.c
@@ -119,6 +119,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_connect(struct connection *conn)
{
int ret;
@@ -160,6 +161,7 @@ error:
*
* Return 0 on success or else a negative errno value.
*/
+ATTR_HIDDEN
int socks5_send_method(struct connection *conn)
{
int ret = 0;
@@ -191,6 +193,7 @@ error:
*
* Return 0 on success or else a negative errno value.
*/
+ATTR_HIDDEN
int socks5_recv_method(struct connection *conn)
{
int ret;
@@ -228,6 +231,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_send_connect_request(struct connection *conn)
{
int ret;
@@ -332,6 +336,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_recv_connect_reply(struct connection *conn)
{
int ret;
@@ -426,6 +431,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_send_resolve_request(const char *hostname, struct connection *conn)
{
int ret, ret_send;
@@ -487,6 +493,7 @@ error:
*
* Return 0 on success else a negative value.
*/
+ATTR_HIDDEN
int socks5_recv_resolve_reply(struct connection *conn, void *addr,
size_t addrlen)
{
@@ -563,6 +570,7 @@ error:
*
* Return 0 on success or else a negative value.
*/
+ATTR_HIDDEN
int socks5_send_resolve_ptr_request(const void *ip, struct connection *conn)
{
int ret, ret_send;
@@ -623,6 +631,7 @@ error:
*
* Return 0 on success else a negative value.
*/
+ATTR_HIDDEN
int socks5_recv_resolve_ptr_reply(struct connection *conn, char **_hostname)
{
int ret;
diff --git a/src/common/utils.c b/src/common/utils.c
index 11a3652..59aa16f 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -163,6 +163,7 @@ char *utils_strsplit(char *separator, char **text, const char *search)
*
* Returns as for strcasecmp.
*/
+ATTR_HIDDEN
int utils_strcasecmpend(const char *s1, const char *s2)
{
size_t n1 = strlen(s1), n2 = strlen(s2);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits