summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2006-07-25 14:06:14 +0000
committerThomas Schwinge <tschwinge@gnu.org>2006-07-25 14:06:14 +0000
commitdd79b1d8f8ae90cd34d5d0b307048c8aaea47d23 (patch)
treeea83d9e7613ae3cee9da9f325c95e83f390eea59
parentbbd40ec2bcd11142b8de273a9c009fe5d2d248f2 (diff)
2006-07-25 Stefan Siegl <stesie@brokenpipe.de>
* pq.c (packet_write): Only dereference AMOUNT if it is not the null pointer and document the change. * pq.h (packet_write): Document the change.
-rw-r--r--libpipe/ChangeLog6
-rw-r--r--libpipe/pq.c8
-rw-r--r--libpipe/pq.h4
3 files changed, 13 insertions, 5 deletions
diff --git a/libpipe/ChangeLog b/libpipe/ChangeLog
index 41074717..caafc582 100644
--- a/libpipe/ChangeLog
+++ b/libpipe/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-25 Stefan Siegl <stesie@brokenpipe.de>
+
+ * pq.c (packet_write): Only dereference AMOUNT if it is not the null
+ pointer and document the change.
+ * pq.h (packet_write): Document the change.
+
2002-04-22 Marcus Brinkmann <marcus@gnu.org>
* pq.c (packet_set_ports): Correctly replace old ports buffer with
diff --git a/libpipe/pq.c b/libpipe/pq.c
index ce49a54c..afdda051 100644
--- a/libpipe/pq.c
+++ b/libpipe/pq.c
@@ -1,6 +1,7 @@
/* Packet queues
- Copyright (C) 1995, 1996, 1998, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1998, 1999, 2002, 2006
+ Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -329,7 +330,7 @@ packet_read_ports (struct packet *packet,
}
/* Append the bytes in DATA, of length DATA_LEN, to what's already in PACKET,
- and return the amount appended in AMOUNT. */
+ and return the amount appended in AMOUNT if that's not the null pointer. */
error_t
packet_write (struct packet *packet,
char *data, size_t data_len, size_t *amount)
@@ -342,7 +343,8 @@ packet_write (struct packet *packet,
/* Add the new data. */
bcopy (data, packet->buf_end, data_len);
packet->buf_end += data_len;
- *amount = data_len;
+ if (amount != NULL)
+ *amount = data_len;
return 0;
}
diff --git a/libpipe/pq.h b/libpipe/pq.h
index b98c8b19..3a26aa80 100644
--- a/libpipe/pq.h
+++ b/libpipe/pq.h
@@ -1,6 +1,6 @@
/* Packet queues
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 2006 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -78,7 +78,7 @@ packet_readable (struct packet *packet)
}
/* Append the bytes in DATA, of length DATA_LEN, to what's already in PACKET,
- and return the amount appended in AMOUNT. */
+ and return the amount appended in AMOUNT if that's not the null pointer. */
error_t packet_write (struct packet *packet,
char *data, size_t data_len, size_t *amount);