[gnio] Support passing -1 as num_* in g_socket_send_message
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnio] Support passing -1 as num_* in g_socket_send_message
- Date: Tue, 28 Apr 2009 06:09:18 -0400 (EDT)
commit ef73b83e0f70ed2a0e51b45cf00e38cd16bd6684
Author: Alexander Larsson <alexl redhat com>
Date: Tue Apr 28 11:07:39 2009 +0200
Support passing -1 as num_* in g_socket_send_message
As is typical in glib APIs, we support -1 as a count to mean look for
NULL-termination of arrays.
---
gio/gsocket.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 468deca..01fa3e6 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -1012,6 +1012,12 @@ g_socket_send_message (GSocket *socket,
/* iov */
{
+ if (num_vectors == -1)
+ {
+ for (num_vectors = 0; vectors[num_vectors].buffer != NULL; num_vectors++)
+ ;
+ }
+
if (num_vectors == 0)
{
char *zero;
@@ -1059,6 +1065,12 @@ g_socket_send_message (GSocket *socket,
struct cmsghdr *cmsg;
gint i;
+ if (num_messages == -1)
+ {
+ for (num_messages = 0; messages[num_messages] != NULL; num_messages++)
+ ;
+ }
+
msg.msg_controllen = 0;
for (i = 0; i < num_messages; i++)
msg.msg_controllen += g_socket_control_message_space (messages[i]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]