Skip to content

Commit

Permalink
Use WTH_EXPORT throughout the code
Browse files Browse the repository at this point in the history
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
  • Loading branch information
Emilio Pozuelo Monfort committed Oct 12, 2016
1 parent febbe6b commit a0d7f82
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 65 deletions.
2 changes: 0 additions & 2 deletions src/waltham/header-preamble.txt
Expand Up @@ -47,5 +47,3 @@ struct wthp_seat;
struct wthp_surface;
struct wthp_touch;

#define APICALL __attribute__ ((visibility ("default")))

46 changes: 23 additions & 23 deletions src/waltham/waltham-connection.c
Expand Up @@ -31,12 +31,12 @@

#include <glib.h>

#include <waltham-object.h>

#include "waltham-connection.h"

#include "message.h"
#include "marshaller.h"
#include "waltham-object.h"
#include "waltham-util.h"

#include "waltham-connection.h"

// FIXME
struct wth_display {
Expand Down Expand Up @@ -64,7 +64,7 @@ struct wth_connection {
};


struct wth_connection *
WTH_EXPORT struct wth_connection *
wth_connect_to_server(const char *host, const char *port)
{
struct wth_connection *conn = NULL;
Expand All @@ -78,7 +78,7 @@ wth_connect_to_server(const char *host, const char *port)
return conn;
}

struct wth_connection *
WTH_EXPORT struct wth_connection *
wth_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
{
struct wth_connection *conn = NULL;
Expand All @@ -92,7 +92,7 @@ wth_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
return conn;
}

struct wth_connection *
WTH_EXPORT struct wth_connection *
wth_connection_from_fd(int fd, enum wth_connection_side side)
{
struct wth_connection *conn;
Expand Down Expand Up @@ -120,51 +120,51 @@ wth_connection_from_fd(int fd, enum wth_connection_side side)
return conn;
}

int
WTH_EXPORT int
wth_connection_get_fd(struct wth_connection *conn)
{
return conn->fd;
}

struct wth_display *
WTH_EXPORT struct wth_display *
wth_connection_get_display(struct wth_connection *conn)
{
return conn->display;
}

int
WTH_EXPORT int
wth_connection_get_next_message_id(struct wth_connection *conn)
{
return conn->next_message_id++;
}

int
WTH_EXPORT int
wth_connection_get_next_object_id(struct wth_connection *conn)
{
return ++conn->next_object_id;
}

void
WTH_EXPORT void
wth_connection_insert_object(struct wth_connection *conn,
struct wth_object *obj)
{
g_hash_table_insert (conn->hash, GUINT_TO_POINTER (obj->id), obj);
}

void
WTH_EXPORT void
wth_connection_remove_object(struct wth_connection *conn,
struct wth_object *obj)
{
g_hash_table_remove (conn->hash, GUINT_TO_POINTER (obj->id));
}

struct wth_object *
WTH_EXPORT struct wth_object *
wth_connection_get_object(struct wth_connection *conn, uint32_t id)
{
return g_hash_table_lookup (conn->hash, GUINT_TO_POINTER (id));
}

void
WTH_EXPORT void
wth_connection_destroy(struct wth_connection *conn)
{
close(conn->fd);
Expand All @@ -176,7 +176,7 @@ wth_connection_destroy(struct wth_connection *conn)
free(conn);
}

int
WTH_EXPORT int
wth_connection_flush(struct wth_connection *conn)
{
/* FIXME currently we don't use the ringbuffer to send messages,
Expand All @@ -186,7 +186,7 @@ wth_connection_flush(struct wth_connection *conn)
return 0;
}

int
WTH_EXPORT int
wth_connection_read(struct wth_connection *conn)
{
if (!reader_pull_new_messages(conn->reader, conn->fd, TRUE))
Expand All @@ -195,7 +195,7 @@ wth_connection_read(struct wth_connection *conn)
return 0;
}

int
WTH_EXPORT int
wth_connection_dispatch(struct wth_connection *conn)
{
int i, complete;
Expand All @@ -219,20 +219,20 @@ wth_connection_dispatch(struct wth_connection *conn)
return complete;
}

int
WTH_EXPORT int
wth_roundtrip(struct wth_connection *conn)
{
// FIXME
return -1;
}

void
WTH_EXPORT void
wth_connection_set_error(struct wth_connection *conn, int err)
{
conn->error = err;
}

void
WTH_EXPORT void
wth_connection_set_protocol_error(struct wth_connection *conn,
uint32_t object_id,
const char *interface,
Expand All @@ -244,13 +244,13 @@ wth_connection_set_protocol_error(struct wth_connection *conn,
conn->protocol_error.code = error_code;
}

int
WTH_EXPORT int
wth_connection_get_error(struct wth_connection *conn)
{
return conn->error;
}

uint32_t
WTH_EXPORT uint32_t
wth_connection_get_protocol_error(struct wth_connection *conn,
const char **interface,
uint32_t *object_id)
Expand Down
40 changes: 19 additions & 21 deletions src/waltham/waltham-connection.h
Expand Up @@ -36,8 +36,6 @@
extern "C" {
#endif

#define APICALL __attribute__ ((visibility ("default")))

/** A Waltham connection
*
* This represents the TCP connection carrying Waltham messages.
Expand Down Expand Up @@ -96,7 +94,7 @@ struct wth_connection;
* and flush etc.
*/
struct wth_connection *
wth_connect_to_server(const char *host, const char *port) APICALL;
wth_connect_to_server(const char *host, const char *port);

/** Accept a Waltham client connection
*
Expand All @@ -112,7 +110,7 @@ wth_connect_to_server(const char *host, const char *port) APICALL;
* socket.
*/
struct wth_connection *
wth_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) APICALL;
wth_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);

enum wth_connection_side {
WTH_CONNECTION_SIDE_CLIENT,
Expand All @@ -135,7 +133,7 @@ enum wth_connection_side {
* But this is completely optional otherwise.
*/
struct wth_connection *
wth_connection_from_fd(int fd, enum wth_connection_side side) APICALL;
wth_connection_from_fd(int fd, enum wth_connection_side side);

/** Get connection file descriptor
*
Expand All @@ -152,7 +150,7 @@ wth_connection_from_fd(int fd, enum wth_connection_side side) APICALL;
* The fd will remain owned by the wth_connection.
*/
int
wth_connection_get_fd(struct wth_connection *conn) APICALL;
wth_connection_get_fd(struct wth_connection *conn);

/** Get the Waltham display object
*
Expand All @@ -168,7 +166,7 @@ wth_connection_get_fd(struct wth_connection *conn) APICALL;
* This method is only used by clients.
*/
struct wth_display *
wth_connection_get_display(struct wth_connection *conn) APICALL;
wth_connection_get_display(struct wth_connection *conn);

/** Get an id to use in a message
*
Expand All @@ -178,7 +176,7 @@ wth_connection_get_display(struct wth_connection *conn) APICALL;
* Return the next id, to use in a new message.
*/
int
wth_connection_get_next_message_id(struct wth_connection *conn) APICALL;
wth_connection_get_next_message_id(struct wth_connection *conn);

/** Get an id to use in an object
*
Expand All @@ -188,18 +186,18 @@ wth_connection_get_next_message_id(struct wth_connection *conn) APICALL;
* Return a free object id, to use in a new object.
*/
int
wth_connection_get_next_object_id(struct wth_connection *conn) APICALL;
wth_connection_get_next_object_id(struct wth_connection *conn);

void
wth_connection_insert_object(struct wth_connection *conn,
struct wth_object *obj) APICALL;
struct wth_object *obj);

void
wth_connection_remove_object(struct wth_connection *conn,
struct wth_object *obj) APICALL;
struct wth_object *obj);

struct wth_object *
wth_connection_get_object(struct wth_connection *conn, uint32_t id) APICALL;
wth_connection_get_object(struct wth_connection *conn, uint32_t id);

/** Disconnect
*
Expand All @@ -211,7 +209,7 @@ wth_connection_get_object(struct wth_connection *conn, uint32_t id) APICALL;
* This call does not block. Messages still en route may get discarded.
*/
void
wth_connection_destroy(struct wth_connection *conn) APICALL;
wth_connection_destroy(struct wth_connection *conn);

/** Flush buffered messages to the network
*
Expand All @@ -231,7 +229,7 @@ wth_connection_destroy(struct wth_connection *conn) APICALL;
* reach the client.
*/
int
wth_connection_flush(struct wth_connection *conn) APICALL;
wth_connection_flush(struct wth_connection *conn);

/** Read data received from the network
*
Expand All @@ -250,7 +248,7 @@ wth_connection_flush(struct wth_connection *conn) APICALL;
* discarded.
*/
int
wth_connection_read(struct wth_connection *conn) APICALL;
wth_connection_read(struct wth_connection *conn);

/** Dispatch incoming messages
*
Expand All @@ -273,7 +271,7 @@ wth_connection_read(struct wth_connection *conn) APICALL;
* to ensure the error event gets delivered to the client.
*/
int
wth_connection_dispatch(struct wth_connection *conn) APICALL;
wth_connection_dispatch(struct wth_connection *conn);

/** Make a roundtrip from client
*
Expand All @@ -291,7 +289,7 @@ wth_connection_dispatch(struct wth_connection *conn) APICALL;
* XXX: define EPROTO behaviour
*/
int
wth_roundtrip(struct wth_connection *conn) APICALL;
wth_roundtrip(struct wth_connection *conn);

/* Set wth_connection to errored state
*
Expand All @@ -303,7 +301,7 @@ wth_roundtrip(struct wth_connection *conn) APICALL;
* This should probably not be public exported API.
*/
void
wth_connection_set_error(struct wth_connection *conn, int err) APICALL;
wth_connection_set_error(struct wth_connection *conn, int err);

/* Set wth_connection into protocol error state
*
Expand All @@ -316,7 +314,7 @@ void
wth_connection_set_protocol_error(struct wth_connection *conn,
uint32_t object_id,
const char *interface,
uint32_t error_code) APICALL;
uint32_t error_code);

/** Return the connection error state
*
Expand All @@ -327,7 +325,7 @@ wth_connection_set_protocol_error(struct wth_connection *conn,
* can be used to get the protocol error details.
*/
int
wth_connection_get_error(struct wth_connection *conn) APICALL;
wth_connection_get_error(struct wth_connection *conn);

/** Return protocol error details
*
Expand All @@ -346,7 +344,7 @@ wth_connection_get_error(struct wth_connection *conn) APICALL;
uint32_t
wth_connection_get_protocol_error(struct wth_connection *conn,
const char **interface,
uint32_t *object_id) APICALL;
uint32_t *object_id);

#ifdef __cplusplus
}
Expand Down

0 comments on commit a0d7f82

Please sign in to comment.