[gnet-dev] gnet_io_channel_writen() clarification



First off... I just recently started programming with GLib and I discovered GNet just a few minutes ago. I'm pleased to report I got a simple program up and running in somewhere under 10 minutes! (All it does is contact a web server and "GET /" the root page).

However I've encountered a small inconsistency in the documentation for gnet_io_channel_writen().

The comments in the source and the online documentation both say: "If bytes_writtenp is set, the number of bytes written is stored in the integer it points to."

To me, this implies that if bytes_writtenp is NULL (i.e. "not set"), then the number of bytes written will not be stored.

However, in the source for this function (iochannel.c) there is the test:

g_return_val_if_fail (bytes_writtenp, G_IO_ERROR_INVAL);

Thus this function cannot be used if bytes_writtenp == NULL, i.e., if the caller doesn't care about the number of bytes written. This is perfectly fine behavior; but the documentation and reality are not in sync. If it is required that bytes_writtenp point somewhere valid, then the perhaps the documentation should be updated to make it clearer.

A similar inconsistency exists for the other function, gnet_io_channel_readn().

I'm not subscribed to the list, so please CC me on any reply.

Thanks,

Scott Long
SwiftView, Inc. http://www.swiftview.com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]