From 292eb1b63dcd8794b468f11cdec55afdbd5c48f6 Mon Sep 17 00:00:00 2001
From: Anneli Cuss
Date: Wed, 7 Sep 2011 09:08:59 +1000
Subject: ei_decode_ei_term() returns 1 if index is incremented
This documentation is a bit perplexing when viewed in light of
erl_interface/src/misc/ei_decode_term.c.
---
lib/erl_interface/doc/src/ei.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/erl_interface/doc/src/ei.xml b/lib/erl_interface/doc/src/ei.xml
index de4e4b4301..76e02a6858 100644
--- a/lib/erl_interface/doc/src/ei.xml
+++ b/lib/erl_interface/doc/src/ei.xml
@@ -581,9 +581,9 @@ ei_x_encode_empty_list(&x);
union, it is decoded, and the appropriate field
in value]]> is set, and is
incremented by the term size.
- The function returns 0 on successful decoding, -1 on error,
- and 1 if the term seems alright, but does not fit in the
- structure. If it returns 0, the
+
The function returns 1 on successful decoding, -1 on error,
+ and 0 if the term seems alright, but does not fit in the
+ structure. If it returns 1, the
will be incremented, and the contains the
decoded term.
The structure will contain the arity for a tuple
--
cgit v1.2.3
From ff9a8a6340908344b0a06cf96f93180ec9479d3a Mon Sep 17 00:00:00 2001
From: Anneli Cuss
Date: Wed, 7 Sep 2011 09:17:42 +1000
Subject: Make comment reflect code in erl_interface/src/misc/ei_decode_term.c
Note that ei_decode_term.h has the correct behaviour described!
Also removed extraneous '/* return 0; */' comments.
---
lib/erl_interface/src/misc/ei_decode_term.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/erl_interface/src/misc/ei_decode_term.c b/lib/erl_interface/src/misc/ei_decode_term.c
index bfb4571337..0b82ef0e35 100644
--- a/lib/erl_interface/src/misc/ei_decode_term.c
+++ b/lib/erl_interface/src/misc/ei_decode_term.c
@@ -25,8 +25,8 @@
#include "ei_decode_term.h"
#include "putget.h"
-/* Returns 0 on successful encoding, -1 on error, and 1 if the term seems
- alright, but does not fit in the term structure. If it returns 0, the
+/* Returns 1 on successful encoding, -1 on error, and 0 if the term seems
+ alright, but does not fit in the term structure. If it returns 1, the
index will be incremented, and the term contains the decoded term. */
int ei_decode_ei_term(const char* buf, int* index, ei_term* term)
@@ -111,10 +111,10 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term)
break;
case ERL_SMALL_TUPLE_EXT:
term->arity = get8(s);
- break; /*return 0;*/
+ break;
case ERL_LARGE_TUPLE_EXT:
term->arity = get32be(s);
- break; /*return 0;*/
+ break;
case ERL_NIL_EXT:
term->arity = 0;
break;
@@ -123,7 +123,7 @@ int ei_decode_ei_term(const char* buf, int* index, ei_term* term)
return 0;
case ERL_LIST_EXT:
term->arity = get32be(s);
- break; /*return 0;*/
+ break;
case ERL_BINARY_EXT:
term->size = get32be(s);
return 0;
--
cgit v1.2.3