Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH 2/2] sql: fix tuple format leak
Date: Fri, 13 Apr 2018 11:40:28 +0300	[thread overview]
Message-ID: <88C66C1B-1B44-46F7-A332-76294FCDFB5B@tarantool.org> (raw)


>1. If you use internal structures like struct iterator, then lets
>manage them using internal API - iterator_delete(). I know, that
>box_iterator_t is the same as struct iterator, but lets be
>consistent.

Fixed:

-               box_iterator_free(cursor->iter);
+               iterator_delete(cursor->iter);

>2. Lets store comments near to function declarations rather
>than implementations.

Fixed:

--- a/src/box/sql/cursor.c
+++ b/src/box/sql/cursor.c
@@ -33,17 +33,11 @@
 #include "tarantoolInt.h"
 #include "box/tuple.h"
 
-/**
- * Release tuple, free iterator, invalidate cursor's state.
- * Note that this routine doesn't nullify space and index:
- * it is also used during OP_NullRow opcode to refresh given
- * cursor.
- */

@@ -72,10 +66,6 @@ sqlite3CursorZero(BtCursor * p)
        memset(p, 0, sizeof(*p));
 }
 
-/**
- * Close a cursor and invalidate its state. In case of
- * ephemeral cursor, corresponding space should be dropped.
- */

--- a/src/box/sql/cursor.h
+++ b/src/box/sql/cursor.h
@@ -72,6 +72,10 @@ struct BtCursor {
 void sqlite3CursorZero(BtCursor *);
 void sqlite3CursorHintFlags(BtCursor *, unsigned);
 
+/**
+ * Close a cursor and invalidate its state. In case of
+ * ephemeral cursor, corresponding space should be dropped.
+ */
 void
 sql_cursor_close(struct BtCursor *cursor);
 int sqlite3CursorMovetoUnpacked(BtCursor *, UnpackedRecord * pUnKey, int *pRes);
@@ -80,6 +84,12 @@ int sqlite3CursorNext(BtCursor *, int *pRes);
 int sqlite3CursorPrevious(BtCursor *, int *pRes);
 int sqlite3CursorPayload(BtCursor *, u32 offset, u32 amt, void *);
 
+/**
+ * Release tuple, free iterator, invalidate cursor's state.
+ * Note that this routine doesn't nullify space and index:
+ * it is also used during OP_NullRow opcode to refresh given
+ * cursor.
+ */
 void
 sql_cursor_cleanup(struct BtCursor *cursor);

                 reply	other threads:[~2018-04-13  8:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=88C66C1B-1B44-46F7-A332-76294FCDFB5B@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH 2/2] sql: fix tuple format leak' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox