Sundry FFI fixes (see bug #127)
authorSteve Youngs <steve@sxemacs.org>
Thu, 16 Jun 2011 02:36:17 +0000 (12:36 +1000)
committerSteve Youngs <steve@sxemacs.org>
Thu, 16 Jun 2011 02:36:17 +0000 (12:36 +1000)
Here are a couple of FFI fixes that bring us closer to fixing bug #127

* lisp/ffi/ffi-sqlite.el (sqlite-bind-value): Use sqlite-STATIC
instead of sqlite-TRANSIENT

* src/effi.c (ffi_call_using_libffi): Temporarily turn of async
timeouts when calling ffi_call()

* src/signal.c (stop_async_timeouts): Make it available
externally.

* src/signal.c (start_async_timeouts): Ditto.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
lisp/ffi/ffi-sqlite.el
src/effi.c
src/signal.c

index 6f7b371..3dbffa5 100644 (file)
@@ -315,14 +315,14 @@ provide COPY-FLAG argument."
              (sqlite:bind-double statement key value))
             ((stringp value)
              (sqlite:bind-text statement key value (length value)
-                               (or copy-flag sqlite-TRANSIENT)))
+                               (or copy-flag sqlite-STATIC)))
             ((and (consp value) (eq (car value) 'blob)
                   (stringp (cdr value)))
              (let ((bval (ffi-create-fo `(c-data . ,(length (cdr value)))
                                         (cdr value))))
                (sqlite:bind-blob
                 statement key bval (length (cdr value))
-                (or copy-flag sqlite-TRANSIENT))))
+                (or copy-flag sqlite-STATIC))))
             (t (error 'sqlite-datatype-error value
                       :comment (concat "Attempt to insert data not one of "
                                        "integer, float, text, or blob."))))
index 4f0635e..ad4b27d 100644 (file)
@@ -1340,8 +1340,10 @@ ffi_call_using_libffi(Lisp_Object fo_fun, Lisp_Object ret_fo,
         if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, in_nargs,
                          rtype, ex_ffitypes) == FFI_OK)
         {
+               stop_async_timeouts();
                 ffi_call(&cif, (void(*)(void))XEFFIO(fo_fun)->fop.fun, rvalue,
                          ex_values);
+               start_async_timeouts();
                 return 0;
         }
 
index fe6abfb..9251a0a 100644 (file)
@@ -210,7 +210,7 @@ static void init_async_timeouts(void)
 
 /* Turn off async timeouts.  */
 
-static void stop_async_timeouts(void)
+extern void stop_async_timeouts(void)
 {
        if (async_timer_suppress_count == 0) {
                /* If timer was on, turn it off. */
@@ -223,7 +223,7 @@ static void stop_async_timeouts(void)
 
 /* Turn on async timeouts again. */
 
-static void start_async_timeouts(void)
+extern void start_async_timeouts(void)
 {
        assert(async_timer_suppress_count > 0);
        async_timer_suppress_count--;