shared/json: add helper to ref first, unref second
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 9 May 2022 13:10:36 +0000 (15:10 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 May 2022 15:08:34 +0000 (17:08 +0200)
commitce913e0ec4c97651c7c1509b72fb81ee61d80c6a
tree81fa08f147a748ab1b6dc9519d30558293e4ba7f
parent7e4be6a5845f983a299932d4ccb2c4349cf8dd52
shared/json: add helper to ref first, unref second

This normally wouldn't happen, but if some of those places were called
with lhs and rhs being the same object, we could unref the last ref first,
and then try to take the ref again. It's easier to be safe, and with the
helper we save some lines too.
src/shared/json.c
src/shared/json.h