[PATCH 11 of 14 RFC c-hglib:level0] hg_current_channel: reading the channel for the current chunk of data

Iulian Stana julian.stana at gmail.com
Tue Sep 3 15:30:50 CDT 2013


# HG changeset patch
# User Iulian Stana <julian.stana at gmail.com>
# Date 1378236876 -10800
#      Tue Sep 03 22:34:36 2013 +0300
# Node ID 9fadfe4d06beabcf95a1f3a20a070431db795704
# Parent  ce2e0a81d30f6846e5d9bfcdfae9d6b1f060ea4f
hg_current_channel: reading the channel for the current chunk of data

diff --git a/client.c b/client.c
--- a/client.c
+++ b/client.c
@@ -342,3 +342,16 @@
 
 	return handle->next_header.channel;
 }
+
+/*
+ * The channel for the current chunk of data.
+ * */
+char hg_current_channel(hg_handle *handle)
+{
+	if(!handle) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	return handle->current_header.channel;
+}
diff --git a/client.h b/client.h
--- a/client.h
+++ b/client.h
@@ -152,4 +152,20 @@
  * */
 char hg_next_channel(hg_handle *handle);
 
+/**
+ * \brief Reading the channel for the current chunk of data.
+ *
+ * Probably you haven't saved the channel from you last action and probably
+ * you still need to know what channel it was.
+ * This function will return the current channel for the connection established
+ * by the handle.
+ * \param handle The handle of the connection, wherewith I want to communicate
+ * \retval   0 if successful
+ * \retval  -1 to indicate an error, with errno set appropriately.
+ *
+ * errno can be:
+ *      - EINVAL   - Invalid argument (handle it's set to a null pointer)
+ * */
+char hg_current_channel(hg_handle *handle);
+
 #endif


More information about the Mercurial-devel mailing list