mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
Add GBytes variants for GSocket receive methods
The current buffer API is pretty much C-specific, and cannot be adequately described in a way that is friendly to introspection and language bindings: the passed buffer is allocated by the caller, but the written size of the buffer is in the return value. Using GBytes, we get a better API at the cost of an additional allocation.
This commit is contained in:
committed by
Philip Withnall
parent
7688965491
commit
7cb953dab8
@@ -210,6 +210,12 @@ gssize g_socket_receive (GSocket
|
||||
gsize size,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GIO_AVAILABLE_IN_2_80
|
||||
GBytes * g_socket_receive_bytes (GSocket *socket,
|
||||
gsize size,
|
||||
gint64 timeout_us,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GIO_AVAILABLE_IN_ALL
|
||||
gssize g_socket_receive_from (GSocket *socket,
|
||||
GSocketAddress **address,
|
||||
@@ -217,6 +223,13 @@ gssize g_socket_receive_from (GSocket
|
||||
gsize size,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GIO_AVAILABLE_IN_2_80
|
||||
GBytes * g_socket_receive_bytes_from (GSocket *socket,
|
||||
GSocketAddress **address,
|
||||
gsize size,
|
||||
gint64 timeout_us,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GIO_AVAILABLE_IN_ALL
|
||||
gssize g_socket_send (GSocket *socket,
|
||||
const gchar *buffer,
|
||||
|
Reference in New Issue
Block a user