Hello,

I am playing around with the C API, and am straggling to express the
following pattern:

        db = (sqlite3*)scm_foreign_object_ref(conn, 0);
        if ((ret = sqlite3_close_v2(db)) == SQLITE_OK)
                scm_foreign_object_set_x(conn, 0, 0);

If I read the documentation right, this code is wrong, because
scm_foreign_object_set_x can have early exit and not store the change to
0.  Is that correct?  And if so, how do I solve this?

Only idea I have is to store sqlite3** in the slot, and then mark the
destruction by *db = 0 (bypassing the need to call
scm_foreign_object_set_x), but there has to be more elegant, common way,
right?

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Reply via email to