From bebb9192e90f148c387d9c5c355b76a6e8fbd238 Mon Sep 17 00:00:00 2001
From: Dmitry Simonenko <pmwkaa@gmail.com>
Date: Fri, 11 Jan 2013 23:29:24 +0400
Subject: [PATCH] connector-c-lite: tp_getreqid added, fixed tp_req.

---
 connector/c/include/tp.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/connector/c/include/tp.h b/connector/c/include/tp.h
index aa9c13050b..13bc444954 100644
--- a/connector/c/include/tp.h
+++ b/connector/c/include/tp.h
@@ -205,6 +205,12 @@ tp_reqid(struct tp *p, uint32_t reqid) {
 	p->h->reqid = reqid;
 }
 
+static inline uint32_t
+tp_getreqid(struct tp *p) {
+	assert(p->h != NULL);
+	return p->h->reqid;
+}
+
 static inline uint32_t
 tp_tuplecount(struct tp *p) {
 	assert(p->t != NULL);
@@ -493,7 +499,7 @@ tp_reqbuf(char *buf, size_t size) {
 
 static inline ssize_t
 tp_req(struct tp *p) {
-	return tp_reqbuf(p->s, tp_used(p));
+	return tp_reqbuf(p->s, tp_size(p));
 }
 
 static inline size_t
@@ -649,7 +655,7 @@ tp_nextfield(struct tp *p) {
 fetch:;
 	register int rc = tp_leb128load(p, &p->fsz);
 	if (tp_unlikely(rc == -1))
-		return 0;
+		return -1;
 	return 1;
 }
 
-- 
GitLab