From cdf91fc88cab314f912b50d5f01d6b7514294f04 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Mon, 31 Aug 2026 17:51:55 -0400 Subject: [PATCH] Move ffi/write's value argument before the offset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jolt 0.8.0 changes jolt.ffi/write from (write p type offset value) to (write p type value offset), matching babashka.ffi so a signature written for either FFI means the same thing. Every call site here is rewritten: 1 file(s). The two spellings cannot be told apart at runtime — an offset and a value are both integers — so an older jolt running this code would write to the wrong place and report nothing. deps.edn therefore declares :jolt/min-version "0.8.0", which a jolt from 0.8.0 on refuses to run below. An older jolt does not know the key and ignores it, so the floor protects from that release forward; the change itself is in jolt's CHANGELOG. Nothing else moves. read is unchanged, write-field is unchanged, and the offset stays spelled out rather than dropped to the new 3-argument form, so a column of writes into one struct stays a column and the diff is a pure argument swap. --- clj/db/pg.clj | 8 ++++---- deps.edn | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/clj/db/pg.clj b/clj/db/pg.clj index 4e2b9d2..0b6dfcd 100644 --- a/clj/db/pg.clj +++ b/clj/db/pg.clj @@ -284,10 +284,10 @@ params)] (dotimes [i n] (let [[oid p len fmt] (nth cells i)] - (ffi/write types :uint (* i os) oid) - (ffi/write values :pointer (* i ps) p) - (ffi/write lengths :int (* i is) len) - (ffi/write formats :int (* i is) fmt))) + (ffi/write types :uint oid (* i os)) + (ffi/write values :pointer p (* i ps)) + (ffi/write lengths :int len (* i is)) + (ffi/write formats :int fmt (* i is)))) [types values lengths formats (into [types values lengths formats] (remove (fn [p] (ffi/null? p)) (mapv second cells)))])))) diff --git a/deps.edn b/deps.edn index ff15850..6e8a651 100644 --- a/deps.edn +++ b/deps.edn @@ -1,4 +1,9 @@ -{:paths ["clj"] +{;; jolt.ffi/write takes the value BEFORE the offset as of jolt 0.8.0, and the + ;; two spellings are both integers — an older runtime writes to the wrong + ;; place rather than failing. Declare the floor so it refuses instead. + :jolt/min-version "0.8.0" + + :paths ["clj"] ;; clojure.jdbc is the API this library exposes: the published library running on ;; the java.sql shim in db.jdbc-shim, rather than a reimplementation of it here.